pub struct FlatMap<I, U, F>where
U: IntoFallibleIterator,{ /* private fields */ }
Expand description
An iterator which maps each element to another iterator, yielding those iterator’s elements.
Trait Implementations§
Source§impl<I, U, F> FallibleIterator for FlatMap<I, U, F>where
I: FallibleIterator,
U: IntoFallibleIterator<Error = I::Error>,
F: FnMut(I::Item) -> Result<U, I::Error>,
impl<I, U, F> FallibleIterator for FlatMap<I, U, F>where
I: FallibleIterator,
U: IntoFallibleIterator<Error = I::Error>,
F: FnMut(I::Item) -> Result<U, I::Error>,
Source§type Item = <U as IntoFallibleIterator>::Item
type Item = <U as IntoFallibleIterator>::Item
The type being iterated over.
Source§type Error = <U as IntoFallibleIterator>::Error
type Error = <U as IntoFallibleIterator>::Error
The error type.
Source§fn next(&mut self) -> Result<Option<U::Item>, U::Error>
fn next(&mut self) -> Result<Option<U::Item>, U::Error>
Advances the iterator and returns the next value. Read more
Source§fn try_fold<B, E, G>(&mut self, init: B, f: G) -> Result<B, E>
fn try_fold<B, E, G>(&mut self, init: B, f: G) -> Result<B, E>
Applies a function over the elements of the iterator, producing a single final value. Read more
Source§fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
Returns bounds on the remaining length of the iterator. Read more
Source§fn count(self) -> Result<usize, Self::Error>where
Self: Sized,
fn count(self) -> Result<usize, Self::Error>where
Self: Sized,
Consumes the iterator, returning the number of remaining items.
Source§fn last(self) -> Result<Option<Self::Item>, Self::Error>where
Self: Sized,
fn last(self) -> Result<Option<Self::Item>, Self::Error>where
Self: Sized,
Returns the last element of the iterator.
Source§fn nth(&mut self, n: usize) -> Result<Option<Self::Item>, Self::Error>
fn nth(&mut self, n: usize) -> Result<Option<Self::Item>, Self::Error>
Returns the
n
th element of the iterator.Source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
Returns an iterator starting at the same point, but stepping by the given amount at each iteration. Read more
Source§fn chain<I>(self, it: I) -> Chain<Self, I>
fn chain<I>(self, it: I) -> Chain<Self, I>
Returns an iterator which yields the elements of this iterator followed
by another.
Source§fn zip<I>(self, o: I) -> Zip<Self, I::IntoFallibleIter>
fn zip<I>(self, o: I) -> Zip<Self, I::IntoFallibleIter>
Returns an iterator that yields pairs of this iterator’s and another
iterator’s values.
Source§fn map<F, B>(self, f: F) -> Map<Self, F>
fn map<F, B>(self, f: F) -> Map<Self, F>
Returns an iterator which applies a fallible transform to the elements
of the underlying iterator.
Source§fn for_each<F>(self, f: F) -> Result<(), Self::Error>
fn for_each<F>(self, f: F) -> Result<(), Self::Error>
Calls a fallible closure on each element of an iterator.
Source§fn filter<F>(self, f: F) -> Filter<Self, F>
fn filter<F>(self, f: F) -> Filter<Self, F>
Returns an iterator which uses a predicate to determine which values
should be yielded. The predicate may fail; such failures are passed to
the caller.
Source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
Returns an iterator which both filters and maps. The closure may fail;
such failures are passed along to the consumer.
Source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
Returns an iterator which yields the current iteration count as well
as the value.
Source§fn peekable(self) -> Peekable<Self>where
Self: Sized,
fn peekable(self) -> Peekable<Self>where
Self: Sized,
Returns an iterator that can peek at the next element without consuming
it.
Source§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
Returns an iterator that skips elements based on a predicate.
Source§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
Returns an iterator that yields elements based on a predicate.
Source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
Returns an iterator which skips the first
n
values of this iterator.Source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
Returns an iterator that yields only the first
n
values of this
iterator.Source§fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
Returns an iterator which applies a stateful map to values of this
iterator.
Source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
Returns an iterator which maps this iterator’s elements to iterators, yielding those iterators’ values.
Source§fn flatten(self) -> Flatten<Self>
fn flatten(self) -> Flatten<Self>
Returns an iterator which flattens an iterator of iterators, yielding those iterators’ values.
Source§fn fuse(self) -> Fuse<Self>where
Self: Sized,
fn fuse(self) -> Fuse<Self>where
Self: Sized,
Returns an iterator which yields this iterator’s elements and ends after
the first
Ok(None)
. Read moreSource§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
Returns an iterator which passes each element to a closure before returning it.
Source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
Borrow an iterator rather than consuming it. Read more
Source§fn collect<T>(self) -> Result<T, Self::Error>
fn collect<T>(self) -> Result<T, Self::Error>
Transforms the iterator into a collection. Read more
Source§fn partition<B, F>(self, f: F) -> Result<(B, B), Self::Error>
fn partition<B, F>(self, f: F) -> Result<(B, B), Self::Error>
Transforms the iterator into two collections, partitioning elements by a closure.
Source§fn fold<B, F>(self, init: B, f: F) -> Result<B, Self::Error>
fn fold<B, F>(self, init: B, f: F) -> Result<B, Self::Error>
Applies a function over the elements of the iterator, producing a single
final value.
Source§fn all<F>(&mut self, f: F) -> Result<bool, Self::Error>
fn all<F>(&mut self, f: F) -> Result<bool, Self::Error>
Determines if all elements of this iterator match a predicate.
Source§fn any<F>(&mut self, f: F) -> Result<bool, Self::Error>
fn any<F>(&mut self, f: F) -> Result<bool, Self::Error>
Determines if any element of this iterator matches a predicate.
Source§fn find<F>(&mut self, f: F) -> Result<Option<Self::Item>, Self::Error>
fn find<F>(&mut self, f: F) -> Result<Option<Self::Item>, Self::Error>
Returns the first element of the iterator that matches a predicate.
Source§fn find_map<B, F>(&mut self, f: F) -> Result<Option<B>, Self::Error>
fn find_map<B, F>(&mut self, f: F) -> Result<Option<B>, Self::Error>
Applies a function to the elements of the iterator, returning the first non-
None
result.Source§fn position<F>(&mut self, f: F) -> Result<Option<usize>, Self::Error>
fn position<F>(&mut self, f: F) -> Result<Option<usize>, Self::Error>
Returns the position of the first element of this iterator that matches
a predicate. The predicate may fail; such failures are returned to the
caller.
Source§fn max(self) -> Result<Option<Self::Item>, Self::Error>
fn max(self) -> Result<Option<Self::Item>, Self::Error>
Returns the maximal element of the iterator.
Source§fn max_by_key<B, F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>
fn max_by_key<B, F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>
Returns the element of the iterator which gives the maximum value from
the function.
Source§fn max_by<F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>
fn max_by<F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>
Returns the element that gives the maximum value with respect to the function.
Source§fn min(self) -> Result<Option<Self::Item>, Self::Error>
fn min(self) -> Result<Option<Self::Item>, Self::Error>
Returns the minimal element of the iterator.
Source§fn min_by_key<B, F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>
fn min_by_key<B, F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>
Returns the element of the iterator which gives the minimum value from
the function.
Source§fn min_by<F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>
fn min_by<F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>
Returns the element that gives the minimum value with respect to the function.
Source§fn unzip<A, B, FromA, FromB>(self) -> Result<(FromA, FromB), Self::Error>
fn unzip<A, B, FromA, FromB>(self) -> Result<(FromA, FromB), Self::Error>
Converts an iterator of pairs into a pair of containers.
Source§fn cmp<I>(self, other: I) -> Result<Ordering, Self::Error>
fn cmp<I>(self, other: I) -> Result<Ordering, Self::Error>
Lexicographically compares the elements of this iterator to that of
another.
Source§fn partial_cmp<I>(self, other: I) -> Result<Option<Ordering>, Self::Error>
fn partial_cmp<I>(self, other: I) -> Result<Option<Ordering>, Self::Error>
Lexicographically compares the elements of this iterator to that of
another.
Source§fn eq<I>(self, other: I) -> Result<bool, Self::Error>
fn eq<I>(self, other: I) -> Result<bool, Self::Error>
Determines if the elements of this iterator are equal to those of
another.
Source§fn ne<I>(self, other: I) -> Result<bool, Self::Error>
fn ne<I>(self, other: I) -> Result<bool, Self::Error>
Determines if the elements of this iterator are not equal to those of
another.
Source§fn lt<I>(self, other: I) -> Result<bool, Self::Error>
fn lt<I>(self, other: I) -> Result<bool, Self::Error>
Determines if the elements of this iterator are lexicographically less
than those of another.
Source§fn le<I>(self, other: I) -> Result<bool, Self::Error>
fn le<I>(self, other: I) -> Result<bool, Self::Error>
Determines if the elements of this iterator are lexicographically less
than or equal to those of another.
Source§fn gt<I>(self, other: I) -> Result<bool, Self::Error>
fn gt<I>(self, other: I) -> Result<bool, Self::Error>
Determines if the elements of this iterator are lexicographically
greater than those of another.
Source§fn ge<I>(self, other: I) -> Result<bool, Self::Error>
fn ge<I>(self, other: I) -> Result<bool, Self::Error>
Determines if the elements of this iterator are lexicographically
greater than or equal to those of another.
Source§fn iterator(self) -> Iterator<Self> ⓘwhere
Self: Sized,
fn iterator(self) -> Iterator<Self> ⓘwhere
Self: Sized,
Returns a normal (non-fallible) iterator over
Result<Item, Error>
.Auto Trait Implementations§
impl<I, U, F> Freeze for FlatMap<I, U, F>
impl<I, U, F> RefUnwindSafe for FlatMap<I, U, F>where
I: RefUnwindSafe,
F: RefUnwindSafe,
<U as IntoFallibleIterator>::IntoFallibleIter: RefUnwindSafe,
impl<I, U, F> Send for FlatMap<I, U, F>
impl<I, U, F> Sync for FlatMap<I, U, F>
impl<I, U, F> Unpin for FlatMap<I, U, F>
impl<I, U, F> UnwindSafe for FlatMap<I, U, F>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<I> IntoFallibleIterator for Iwhere
I: FallibleIterator,
impl<I> IntoFallibleIterator for Iwhere
I: FallibleIterator,
Source§type Item = <I as FallibleIterator>::Item
type Item = <I as FallibleIterator>::Item
The elements of the iterator.
Source§type Error = <I as FallibleIterator>::Error
type Error = <I as FallibleIterator>::Error
The error value of the iterator.
Source§type IntoFallibleIter = I
type IntoFallibleIter = I
The iterator.
Source§fn into_fallible_iter(self) -> I
fn into_fallible_iter(self) -> I
Creates a fallible iterator from a value.