Earlier quoted context omitted.
function max with type parameter T with arguments a of type T and b of type T and returns a value of type T where T implements trait PartialEq Vs fn max (a: T, b: T) -> T where T: PartialEq
Limiting examples to a subset of Rust syntax will produce more readable answers, sure. You have no lifetimes and no borrows, and very limited generics.
function max
with
a lifetime a,
a lifetime b,
and type parameter T
with
argument a of a reference to type T that lives as long as lifetime a
argument b of a reference to type T that lives as long as lifetime b
and returns a value of type parameter T
where T implements trait PartialEq
Vs fn max(a: &'a T, b: &'b T) -> T
If you want a real life example: #[stable(feature = "rust1", since = "1.0.0")]
impl IntoIterator for &'a Vec {
type Item = &'a T;
type IntoIter = slice::Iter;
fn into_iter(self) -> Self::IntoIter {
self.iter()
}
}
An implementation of trait IntoIterator
(that has been stable since Rust 1.0.0)
with a lifetime a
a type parameter T
a type parameter A which implements the trait Allocator
for a borrow for the duration of lifetime a of type Vec with type parameters T and A
it has an associated type Item, which is a borrow for the duration of lifetime a of type T
it has an associated type IntoIter, which is type Iter from module slice with parameters lifetime a and type T
it has a method into_iter
that consumes the receiver
and returns associated type IntoIter
the methods body
calls method iter on the receiver
and returns its resulting value