Struct iterative_methods::Enumerate[][src]

pub struct Enumerate<I, T> {
    pub current: Option<Numbered<T>>,
    pub it: I,
}
Expand description

An adaptor that enumerates items.

Fields

current: Option<Numbered<T>>it: I

Implementations

impl<I, T> Enumerate<I, T> where
    I: StreamingIterator<Item = T>, 
[src]

Define a constructor in the Enumerate context.

pub fn new(it: I) -> Enumerate<I, T>[src]

Trait Implementations

impl<I: Clone, T: Clone> Clone for Enumerate<I, T>[src]

fn clone(&self) -> Enumerate<I, T>[src]

Returns a copy of the value. Read more

fn clone_from(&mut self, source: &Self)1.0.0[src]

Performs copy-assignment from source. Read more

impl<I: Debug, T: Debug> Debug for Enumerate<I, T>[src]

fn fmt(&self, f: &mut Formatter<'_>) -> Result[src]

Formats the value using the given formatter. Read more

impl<I, T> StreamingIterator for Enumerate<I, T> where
    I: StreamingIterator<Item = T>,
    T: Clone
[src]

type Item = Numbered<T>

The type of the elements being iterated over.

fn advance(&mut self)[src]

Advances the iterator to the next element. Read more

fn get(&self) -> Option<&Self::Item>[src]

Returns a reference to the current element of the iterator. Read more

fn next(&mut self) -> Option<&Self::Item>[src]

Advances the iterator and returns the next value. Read more

fn size_hint(&self) -> (usize, Option<usize>)[src]

Returns the bounds on the remaining length of the iterator.

fn all<F>(&mut self, f: F) -> bool where
    F: FnMut(&Self::Item) -> bool
[src]

Determines if all elements of the iterator satisfy a predicate.

fn any<F>(&mut self, f: F) -> bool where
    F: FnMut(&Self::Item) -> bool
[src]

Determines if any elements of the iterator satisfy a predicate.

fn by_ref(&mut self) -> &mut Self[src]

Borrows an iterator, rather than consuming it. Read more

fn chain<I>(self, other: I) -> Chain<Self, I> where
    I: StreamingIterator<Item = Self::Item>, 
[src]

Consumes two iterators and returns a new iterator that iterates over both in sequence.

fn cloned(self) -> Cloned<Self> where
    Self::Item: Clone
[src]

Produces a normal, non-streaming, iterator by cloning the elements of this iterator.

fn count(self) -> usize[src]

Consumes the iterator, counting the number of remaining elements and returning it.

fn filter<F>(self, f: F) -> Filter<Self, F> where
    F: FnMut(&Self::Item) -> bool
[src]

Creates an iterator which uses a closure to determine if an element should be yielded.

fn filter_map<B, F>(self, f: F) -> FilterMap<Self, B, F> where
    F: FnMut(&Self::Item) -> Option<B>, 
[src]

Creates an iterator which both filters and maps by applying a closure to elements.

fn flat_map<J, F>(self, f: F) -> FlatMap<Self, J, F> where
    F: FnMut(&Self::Item) -> J,
    J: StreamingIterator
[src]

Creates an iterator which flattens iterators obtained by applying a closure to elements. Note that the returned iterators must be streaming iterators. Read more

fn filter_map_deref<B, F>(self, f: F) -> FilterMapDeref<Self, F> where
    F: FnMut(&Self::Item) -> Option<B>, 
[src]

Creates a regular, non-streaming iterator which both filters and maps by applying a closure to elements.

fn find<F>(&mut self, f: F) -> Option<&Self::Item> where
    F: FnMut(&Self::Item) -> bool
[src]

Returns the first element of the iterator that satisfies the predicate.

fn fuse(self) -> Fuse<Self>[src]

Creates an iterator which is “well behaved” at the beginning and end of iteration. Read more

fn inspect<F>(self, f: F) -> Inspect<Self, F> where
    F: FnMut(&Self::Item), 
[src]

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. Read more

fn map<B, F>(self, f: F) -> Map<Self, B, F> where
    F: FnMut(&Self::Item) -> B, 
[src]

Creates an iterator which transforms elements of this iterator by passing them to a closure.

fn map_deref<B, F>(self, f: F) -> MapDeref<Self, F> where
    F: FnMut(&Self::Item) -> B, 
[src]

Creates a regular, non-streaming iterator which transforms elements of this iterator by passing them to a closure.

fn map_ref<B, F>(self, f: F) -> MapRef<Self, F> where
    F: Fn(&Self::Item) -> &B,
    B: ?Sized
[src]

Creates an iterator which transforms elements of this iterator by passing them to a closure. Read more

fn nth(&mut self, n: usize) -> Option<&Self::Item>[src]

Consumes the first n elements of the iterator, returning the next one.

fn position<F>(&mut self, f: F) -> Option<usize> where
    F: FnMut(&Self::Item) -> bool
[src]

Returns the index of the first element of the iterator matching a predicate.

fn skip(self, n: usize) -> Skip<Self>[src]

Creates an iterator which skips the first n elements.

fn skip_while<F>(self, f: F) -> SkipWhile<Self, F> where
    F: FnMut(&Self::Item) -> bool
[src]

Creates an iterator that skips initial elements matching a predicate.

fn take(self, n: usize) -> Take<Self>[src]

Creates an iterator which only returns the first n elements.

fn take_while<F>(self, f: F) -> TakeWhile<Self, F> where
    F: FnMut(&Self::Item) -> bool
[src]

Creates an iterator which only returns initial elements matching a predicate.

fn rev(self) -> Rev<Self> where
    Self: DoubleEndedStreamingIterator
[src]

Creates an iterator which returns elemens in the opposite order.

fn fold<B, F>(self, init: B, f: F) -> B where
    F: FnMut(B, &Self::Item) -> B, 
[src]

Reduces the iterator’s elements to a single, final value.

fn for_each<F>(self, f: F) where
    F: FnMut(&Self::Item), 
[src]

Calls a closure on each element of an iterator.

Auto Trait Implementations

impl<I, T> RefUnwindSafe for Enumerate<I, T> where
    I: RefUnwindSafe,
    T: RefUnwindSafe

impl<I, T> Send for Enumerate<I, T> where
    I: Send,
    T: Send

impl<I, T> Sync for Enumerate<I, T> where
    I: Sync,
    T: Sync

impl<I, T> Unpin for Enumerate<I, T> where
    I: Unpin,
    T: Unpin

impl<I, T> UnwindSafe for Enumerate<I, T> where
    I: UnwindSafe,
    T: UnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

pub fn type_id(&self) -> TypeId[src]

Gets the TypeId of self. Read more

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

pub fn borrow(&self) -> &T[src]

Immutably borrows from an owned value. Read more

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

pub fn borrow_mut(&mut self) -> &mut T[src]

Mutably borrows from an owned value. Read more

impl<T> From<T> for T[src]

pub fn from(t: T) -> T[src]

Performs the conversion.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

pub fn into(self) -> U[src]

Performs the conversion.

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

pub fn to_owned(&self) -> T[src]

Creates owned data from borrowed data, usually by cloning. Read more

pub fn clone_into(&self, target: &mut T)[src]

🔬 This is a nightly-only experimental API. (toowned_clone_into)

recently added

Uses borrowed data to replace owned data, usually by cloning. Read more

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>[src]

Performs the conversion.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>[src]

Performs the conversion.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

pub fn vzip(self) -> V