Trait foreach::ForEach
[−]
[src]
pub trait ForEach: Iterator { fn foreach<O, F>(&mut self, f: F)
where
O: Into<Continue>,
F: FnMut(Self::Item, &mut Self) -> O; }
Trait to simplify usage of iterator inside iteration loop.
This trait is implemented for all iterators by default.
Required Methods
fn foreach<O, F>(&mut self, f: F) where
O: Into<Continue>,
F: FnMut(Self::Item, &mut Self) -> O,
O: Into<Continue>,
F: FnMut(Self::Item, &mut Self) -> O,
Iterates over all items and executes given closure.
This allows you to use iterator inside iteration loop, which is not posible when using for-in loop.
See crate-level docs for examples
Implementors
impl<T: Iterator> ForEach for T