Struct fallible_iterator::Enumerate
source · pub struct Enumerate<I> { /* private fields */ }
Expand description
An iterator that yields the iteration count as well as the values of the underlying iterator.
Trait Implementations§
source§impl<I> FallibleIterator for Enumerate<I>where
I: FallibleIterator,
impl<I> FallibleIterator for Enumerate<I>where I: FallibleIterator,
§type Item = (usize, <I as FallibleIterator>::Item)
type Item = (usize, <I as FallibleIterator>::Item)
The type being iterated over.
§type Error = <I as FallibleIterator>::Error
type Error = <I as FallibleIterator>::Error
The error type.
source§fn next(&mut self) -> Result<Option<(usize, I::Item)>, I::Error>
fn next(&mut self) -> Result<Option<(usize, I::Item)>, I::Error>
Advances the iterator and returns the next 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, I::Error>
fn count(self) -> Result<usize, I::Error>
Consumes the iterator, returning the number of remaining items.
source§fn nth(&mut self, n: usize) -> Result<Option<(usize, I::Item)>, I::Error>
fn nth(&mut self, n: usize) -> Result<Option<(usize, I::Item)>, I::Error>
Returns the
n
th element of the iterator.source§fn try_fold<B, E, F>(&mut self, init: B, f: F) -> Result<B, E>where
E: From<I::Error>,
F: FnMut(B, (usize, I::Item)) -> Result<B, E>,
fn try_fold<B, E, F>(&mut self, init: B, f: F) -> Result<B, E>where E: From<I::Error>, F: FnMut(B, (usize, I::Item)) -> Result<B, E>,
Applies a function over the elements of the iterator, producing a single final value. Read more
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 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>where
I: IntoFallibleIterator<Item = Self::Item, Error = Self::Error>,
Self: Sized,
fn chain<I>(self, it: I) -> Chain<Self, I>where I: IntoFallibleIterator<Item = Self::Item, Error = Self::Error>, Self: Sized,
Returns an iterator which yields the elements of this iterator followed
by another.
source§fn zip<I>(self, o: I) -> Zip<Self, I::IntoFallibleIter>where
Self: Sized,
I: IntoFallibleIterator<Error = Self::Error>,
fn zip<I>(self, o: I) -> Zip<Self, I::IntoFallibleIter>where Self: Sized, I: IntoFallibleIterator<Error = Self::Error>,
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>where
Self: Sized,
F: FnMut(Self::Item) -> Result<B, Self::Error>,
fn map<F, B>(self, f: F) -> Map<Self, F>where Self: Sized, F: FnMut(Self::Item) -> Result<B, Self::Error>,
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>where
Self: Sized,
F: FnMut(Self::Item) -> Result<(), Self::Error>,
fn for_each<F>(self, f: F) -> Result<(), Self::Error>where Self: Sized, F: FnMut(Self::Item) -> Result<(), Self::Error>,
Calls a fallible closure on each element of an iterator.
source§fn filter<F>(self, f: F) -> Filter<Self, F>where
Self: Sized,
F: FnMut(&Self::Item) -> Result<bool, Self::Error>,
fn filter<F>(self, f: F) -> Filter<Self, F>where Self: Sized, F: FnMut(&Self::Item) -> Result<bool, Self::Error>,
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>where
Self: Sized,
F: FnMut(Self::Item) -> Result<Option<B>, Self::Error>,
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>where Self: Sized, F: FnMut(Self::Item) -> Result<Option<B>, Self::Error>,
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>where
Self: Sized,
P: FnMut(&Self::Item) -> Result<bool, Self::Error>,
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>where Self: Sized, P: FnMut(&Self::Item) -> Result<bool, Self::Error>,
Returns an iterator that skips elements based on a predicate.
source§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>where
Self: Sized,
P: FnMut(&Self::Item) -> Result<bool, Self::Error>,
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>where Self: Sized, P: FnMut(&Self::Item) -> Result<bool, Self::Error>,
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>where
Self: Sized,
F: FnMut(&mut St, Self::Item) -> Result<Option<B>, Self::Error>,
fn scan<St, B, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>where Self: Sized, F: FnMut(&mut St, Self::Item) -> Result<Option<B>, Self::Error>,
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>where
Self: Sized,
U: IntoFallibleIterator<Error = Self::Error>,
F: FnMut(Self::Item) -> Result<U, Self::Error>,
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>where Self: Sized, U: IntoFallibleIterator<Error = Self::Error>, F: FnMut(Self::Item) -> Result<U, Self::Error>,
Returns an iterator which maps this iterator’s elements to 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>where
Self: Sized,
F: FnMut(&Self::Item) -> Result<(), Self::Error>,
fn inspect<F>(self, f: F) -> Inspect<Self, F>where Self: Sized, F: FnMut(&Self::Item) -> Result<(), Self::Error>,
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>where
T: FromFallibleIterator<Self::Item>,
Self: Sized,
fn collect<T>(self) -> Result<T, Self::Error>where T: FromFallibleIterator<Self::Item>, Self: Sized,
Transforms the iterator into a collection. Read more
source§fn partition<B, F>(self, f: F) -> Result<(B, B), Self::Error>where
Self: Sized,
B: Default + Extend<Self::Item>,
F: FnMut(&Self::Item) -> Result<bool, Self::Error>,
fn partition<B, F>(self, f: F) -> Result<(B, B), Self::Error>where Self: Sized, B: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> Result<bool, 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>where
Self: Sized,
F: FnMut(B, Self::Item) -> Result<B, Self::Error>,
fn fold<B, F>(self, init: B, f: F) -> Result<B, Self::Error>where Self: Sized, F: FnMut(B, Self::Item) -> 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>where
Self: Sized,
F: FnMut(Self::Item) -> Result<bool, Self::Error>,
fn all<F>(&mut self, f: F) -> Result<bool, Self::Error>where Self: Sized, F: FnMut(Self::Item) -> 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>where
Self: Sized,
F: FnMut(Self::Item) -> Result<bool, Self::Error>,
fn any<F>(&mut self, f: F) -> Result<bool, Self::Error>where Self: Sized, F: FnMut(Self::Item) -> 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>where
Self: Sized,
F: FnMut(&Self::Item) -> Result<bool, Self::Error>,
fn find<F>(&mut self, f: F) -> Result<Option<Self::Item>, Self::Error>where Self: Sized, F: FnMut(&Self::Item) -> Result<bool, 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>where
Self: Sized,
F: FnMut(Self::Item) -> Result<Option<B>, Self::Error>,
fn find_map<B, F>(&mut self, f: F) -> Result<Option<B>, Self::Error>where Self: Sized, F: FnMut(Self::Item) -> 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>where
Self: Sized,
F: FnMut(Self::Item) -> Result<bool, Self::Error>,
fn position<F>(&mut self, f: F) -> Result<Option<usize>, Self::Error>where Self: Sized, F: FnMut(Self::Item) -> Result<bool, 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_by_key<B, F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>where
Self: Sized,
B: Ord,
F: FnMut(&Self::Item) -> Result<B, Self::Error>,
fn max_by_key<B, F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>where Self: Sized, B: Ord, F: FnMut(&Self::Item) -> Result<B, 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>where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Result<Ordering, Self::Error>,
fn max_by<F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Result<Ordering, Self::Error>,
Returns the element that gives the maximum value with respect to the function.
source§fn min_by_key<B, F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>where
Self: Sized,
B: Ord,
F: FnMut(&Self::Item) -> Result<B, Self::Error>,
fn min_by_key<B, F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>where Self: Sized, B: Ord, F: FnMut(&Self::Item) -> Result<B, 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>where
Self: Sized,
F: FnMut(&Self::Item, &Self::Item) -> Result<Ordering, Self::Error>,
fn min_by<F>(self, f: F) -> Result<Option<Self::Item>, Self::Error>where Self: Sized, F: FnMut(&Self::Item, &Self::Item) -> Result<Ordering, 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>where
Self: Sized + FallibleIterator<Item = (A, B)>,
FromA: Default + Extend<A>,
FromB: Default + Extend<B>,
fn unzip<A, B, FromA, FromB>(self) -> Result<(FromA, FromB), Self::Error>where Self: Sized + FallibleIterator<Item = (A, B)>, FromA: Default + Extend<A>, FromB: Default + Extend<B>,
Converts an iterator of pairs into a pair of containers.
source§fn cloned<'a, T>(self) -> Cloned<Self>where
Self: Sized + FallibleIterator<Item = &'a T>,
T: 'a + Clone,
fn cloned<'a, T>(self) -> Cloned<Self>where Self: Sized + FallibleIterator<Item = &'a T>, T: 'a + Clone,
Returns an iterator which clones all of its elements.
source§fn partial_cmp<I>(self, other: I) -> Result<Option<Ordering>, Self::Error>where
Self: Sized,
I: IntoFallibleIterator<Error = Self::Error>,
Self::Item: PartialOrd<I::Item>,
fn partial_cmp<I>(self, other: I) -> Result<Option<Ordering>, Self::Error>where Self: Sized, I: IntoFallibleIterator<Error = Self::Error>, Self::Item: PartialOrd<I::Item>,
Lexicographically compares the elements of this iterator to that of
another.
source§fn eq<I>(self, other: I) -> Result<bool, Self::Error>where
Self: Sized,
I: IntoFallibleIterator<Error = Self::Error>,
Self::Item: PartialEq<I::Item>,
fn eq<I>(self, other: I) -> Result<bool, Self::Error>where Self: Sized, I: IntoFallibleIterator<Error = Self::Error>, Self::Item: PartialEq<I::Item>,
Determines if the elements of this iterator are equal to those of
another.
source§fn ne<I>(self, other: I) -> Result<bool, Self::Error>where
Self: Sized,
I: IntoFallibleIterator<Error = Self::Error>,
Self::Item: PartialEq<I::Item>,
fn ne<I>(self, other: I) -> Result<bool, Self::Error>where Self: Sized, I: IntoFallibleIterator<Error = Self::Error>, Self::Item: PartialEq<I::Item>,
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>where
Self: Sized,
I: IntoFallibleIterator<Error = Self::Error>,
Self::Item: PartialOrd<I::Item>,
fn lt<I>(self, other: I) -> Result<bool, Self::Error>where Self: Sized, I: IntoFallibleIterator<Error = Self::Error>, Self::Item: PartialOrd<I::Item>,
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>where
Self: Sized,
I: IntoFallibleIterator<Error = Self::Error>,
Self::Item: PartialOrd<I::Item>,
fn le<I>(self, other: I) -> Result<bool, Self::Error>where Self: Sized, I: IntoFallibleIterator<Error = Self::Error>, Self::Item: PartialOrd<I::Item>,
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>where
Self: Sized,
I: IntoFallibleIterator<Error = Self::Error>,
Self::Item: PartialOrd<I::Item>,
fn gt<I>(self, other: I) -> Result<bool, Self::Error>where Self: Sized, I: IntoFallibleIterator<Error = Self::Error>, Self::Item: PartialOrd<I::Item>,
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>where
Self: Sized,
I: IntoFallibleIterator<Error = Self::Error>,
Self::Item: PartialOrd<I::Item>,
fn ge<I>(self, other: I) -> Result<bool, Self::Error>where Self: Sized, I: IntoFallibleIterator<Error = Self::Error>, Self::Item: PartialOrd<I::Item>,
Determines if the elements of this iterator are lexicographically
greater than or equal to those of another.
Auto Trait Implementations§
impl<I> RefUnwindSafe for Enumerate<I>where I: RefUnwindSafe,
impl<I> Send for Enumerate<I>where I: Send,
impl<I> Sync for Enumerate<I>where I: Sync,
impl<I> Unpin for Enumerate<I>where I: Unpin,
impl<I> UnwindSafe for Enumerate<I>where I: UnwindSafe,
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<I> IntoFallibleIterator for Iwhere
I: FallibleIterator,
impl<I> IntoFallibleIterator for Iwhere I: FallibleIterator,
§type Item = <I as FallibleIterator>::Item
type Item = <I as FallibleIterator>::Item
The elements of the iterator.
§type Error = <I as FallibleIterator>::Error
type Error = <I as FallibleIterator>::Error
The error value of the iterator.
§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.