pub trait StreamingIterator {
type Item: ?Sized;
Show 31 methods
// Required methods
fn advance(&mut self);
fn get(&self) -> Option<&Self::Item>;
// Provided methods
fn next(&mut self) -> Option<&Self::Item> { ... }
fn size_hint(&self) -> (usize, Option<usize>) { ... }
fn is_done(&self) -> bool { ... }
fn all<F>(&mut self, f: F) -> bool
where Self: Sized,
F: FnMut(&Self::Item) -> bool { ... }
fn any<F>(&mut self, f: F) -> bool
where Self: Sized,
F: FnMut(&Self::Item) -> bool { ... }
fn by_ref(&mut self) -> &mut Self
where Self: Sized { ... }
fn chain<I>(self, other: I) -> Chain<Self, I>
where Self: Sized,
I: StreamingIterator<Item = Self::Item> { ... }
fn cloned(self) -> Cloned<Self>
where Self: Sized,
Self::Item: Clone { ... }
fn copied(self) -> Copied<Self>
where Self: Sized,
Self::Item: Copy { ... }
fn count(self) -> usize
where Self: Sized { ... }
fn filter<F>(self, f: F) -> Filter<Self, F>
where Self: Sized,
F: FnMut(&Self::Item) -> bool { ... }
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, B, F>
where Self: Sized,
F: FnMut(&Self::Item) -> Option<B> { ... }
fn flat_map<J, F>(self, f: F) -> FlatMap<Self, J, F>
where Self: Sized,
J: StreamingIterator,
F: FnMut(&Self::Item) -> J { ... }
fn filter_map_deref<B, F>(self, f: F) -> FilterMapDeref<Self, F>
where Self: Sized,
F: FnMut(&Self::Item) -> Option<B> { ... }
fn find<F>(&mut self, f: F) -> Option<&Self::Item>
where Self: Sized,
F: FnMut(&Self::Item) -> bool { ... }
fn fuse(self) -> Fuse<Self>
where Self: Sized { ... }
fn inspect<F>(self, f: F) -> Inspect<Self, F>
where F: FnMut(&Self::Item),
Self: Sized { ... }
fn map<B, F>(self, f: F) -> Map<Self, B, F>
where Self: Sized,
F: FnMut(&Self::Item) -> B { ... }
fn map_deref<B, F>(self, f: F) -> MapDeref<Self, F>
where Self: Sized,
F: FnMut(&Self::Item) -> B { ... }
fn map_ref<B, F>(self, f: F) -> MapRef<Self, F>
where Self: Sized,
F: Fn(&Self::Item) -> &B,
B: ?Sized { ... }
fn nth(&mut self, n: usize) -> Option<&Self::Item> { ... }
fn position<F>(&mut self, f: F) -> Option<usize>
where Self: Sized,
F: FnMut(&Self::Item) -> bool { ... }
fn skip(self, n: usize) -> Skip<Self>
where Self: Sized { ... }
fn skip_while<F>(self, f: F) -> SkipWhile<Self, F>
where Self: Sized,
F: FnMut(&Self::Item) -> bool { ... }
fn take(self, n: usize) -> Take<Self>
where Self: Sized { ... }
fn take_while<F>(self, f: F) -> TakeWhile<Self, F>
where Self: Sized,
F: FnMut(&Self::Item) -> bool { ... }
fn rev(self) -> Rev<Self>
where Self: Sized + DoubleEndedStreamingIterator { ... }
fn fold<B, F>(self, init: B, f: F) -> B
where Self: Sized,
F: FnMut(B, &Self::Item) -> B { ... }
fn for_each<F>(self, f: F)
where Self: Sized,
F: FnMut(&Self::Item) { ... }
}
Expand description
An interface for dealing with streaming iterators.
Required Associated Types§
Required Methods§
Provided Methods§
Sourcefn next(&mut self) -> Option<&Self::Item>
fn next(&mut self) -> Option<&Self::Item>
Advances the iterator and returns the next value.
The behavior of calling this method after the end of the iterator has been reached is unspecified.
The default implementation simply calls advance
followed by get
.
Sourcefn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Returns the bounds on the remaining length of the iterator.
Sourcefn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
Determines if all elements of the iterator satisfy a predicate.
Sourcefn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
Determines if any elements of the iterator satisfy a predicate.
Sourcefn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Borrows an iterator, rather than consuming it.
This is useful to allow the application of iterator adaptors while still retaining ownership of the original adaptor.
Sourcefn chain<I>(self, other: I) -> Chain<Self, I>
fn chain<I>(self, other: I) -> Chain<Self, I>
Consumes two iterators and returns a new iterator that iterates over both in sequence.
Sourcefn cloned(self) -> Cloned<Self>
fn cloned(self) -> Cloned<Self>
Produces a normal, non-streaming, iterator by cloning the elements of this iterator.
Sourcefn copied(self) -> Copied<Self>
fn copied(self) -> Copied<Self>
Produces a normal, non-streaming, iterator by copying the elements of this iterator.
Sourcefn count(self) -> usizewhere
Self: Sized,
fn count(self) -> usizewhere
Self: Sized,
Consumes the iterator, counting the number of remaining elements and returning it.
Sourcefn filter<F>(self, f: F) -> Filter<Self, F>
fn filter<F>(self, f: F) -> Filter<Self, F>
Creates an iterator which uses a closure to determine if an element should be yielded.
Sourcefn filter_map<B, F>(self, f: F) -> FilterMap<Self, B, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, B, F>
Creates an iterator which both filters and maps by applying a closure to elements.
Sourcefn flat_map<J, F>(self, f: F) -> FlatMap<Self, J, F>
fn flat_map<J, F>(self, f: F) -> FlatMap<Self, J, F>
Creates an iterator which flattens iterators obtained by applying a closure to elements. Note that the returned iterators must be streaming iterators.
Sourcefn filter_map_deref<B, F>(self, f: F) -> FilterMapDeref<Self, F>
fn filter_map_deref<B, F>(self, f: F) -> FilterMapDeref<Self, F>
Creates a regular, non-streaming iterator which both filters and maps by applying a closure to elements.
Sourcefn find<F>(&mut self, f: F) -> Option<&Self::Item>
fn find<F>(&mut self, f: F) -> Option<&Self::Item>
Returns the first element of the iterator that satisfies the predicate.
Sourcefn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
Creates an iterator which is “well behaved” at the beginning and end of iteration.
The behavior of calling get
before iteration has been started, and of continuing to call
advance
after get
has returned None
is normally unspecified, but this guarantees that
get
will return None
in both cases.
Sourcefn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Call a closure on each element, passing the element on.
The closure is called upon calls to advance
or advance_back
, and exactly once per element
regardless of how many times (if any) get
is called.
Sourcefn map<B, F>(self, f: F) -> Map<Self, B, F>
fn map<B, F>(self, f: F) -> Map<Self, B, F>
Creates an iterator which transforms elements of this iterator by passing them to a closure.
Sourcefn map_deref<B, F>(self, f: F) -> MapDeref<Self, F>
fn map_deref<B, F>(self, f: F) -> MapDeref<Self, F>
Creates a regular, non-streaming iterator which transforms elements of this iterator by passing them to a closure.
Sourcefn map_ref<B, F>(self, f: F) -> MapRef<Self, F>
fn map_ref<B, F>(self, f: F) -> MapRef<Self, F>
Creates an iterator which transforms elements of this iterator by passing them to a closure.
Unlike map
, this method takes a closure that returns a reference into the original value.
The mapping function is only guaranteed to be called at some point before an element
is actually consumed. This allows an expensive mapping function to be ignored
during skipping (e.g. nth
).
Sourcefn nth(&mut self, n: usize) -> Option<&Self::Item>
fn nth(&mut self, n: usize) -> Option<&Self::Item>
Consumes the first n
elements of the iterator, returning the next one.
Sourcefn position<F>(&mut self, f: F) -> Option<usize>
fn position<F>(&mut self, f: F) -> Option<usize>
Returns the index of the first element of the iterator matching a predicate.
Sourcefn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
Creates an iterator which skips the first n
elements.
Sourcefn skip_while<F>(self, f: F) -> SkipWhile<Self, F>
fn skip_while<F>(self, f: F) -> SkipWhile<Self, F>
Creates an iterator that skips initial elements matching a predicate.
Sourcefn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
Creates an iterator which only returns the first n
elements.
Sourcefn take_while<F>(self, f: F) -> TakeWhile<Self, F>
fn take_while<F>(self, f: F) -> TakeWhile<Self, F>
Creates an iterator which only returns initial elements matching a predicate.
Sourcefn rev(self) -> Rev<Self>where
Self: Sized + DoubleEndedStreamingIterator,
fn rev(self) -> Rev<Self>where
Self: Sized + DoubleEndedStreamingIterator,
Creates an iterator which returns elemens in the opposite order.