最经典的例子:
trait StreamingIterator {
type Item<'a>;
fn next<'a>(&'a mut self) -> Option<Self::Item<'a>>;
}
This trait is very useful - it allows for a kind of Iterator which yields values which have a lifetime tied to the lifetime of the reference passed to next.
A particular obvious use case for this trait would be an iterator over a vector which yields overlappi
登录后可查看完整内容,参与讨论!
立即登录