The Iterator
trait is defined as follows:
pub trait Iterator {
type Item;
fn next(&mut self) -> Option<Self::Item>;
}
What does type Item;
mean? And how to call it?
Is the definition above equivalent to this one?
pub trait Iterator<T> {
fn next(&mut self) -> Option<T>;
}
If it's the same why declare it that way? And if it's not the same then what's the difference?