It should be able to mutate self , because it is promoting an iterator. Each time you call next , the iterator mutates:
fn next(&mut self) -> Option<Self::Item>;
Here is the find implementation :
fn find<P>(&mut self, mut predicate: P) -> Option<Self::Item> where Self: Sized, P: FnMut(&Self::Item) -> bool, { for x in self.by_ref() { if predicate(&x) { return Some(x) } } None }
source share