A simple example for generic parameters of trait function:
trait Ext: Sized {
fn then<R>(self, f: fn(Self) -> R) -> R {
f(self)
}
}
impl<T> Ext for T {}
A simple example for generic parameters of trait:
trait Ext<R>: Sized {
fn then(self, f: fn(Self) -> R) -> R {
f(self)
}
}
impl<T, R> Ext<R> for T {}
What's the difference between the two?
When should I use "generic parameters of trait function" and when should I use "generic parameters of trait"?