Chain

Struct Chain 

Source
pub struct Chain<A, B> { /* private fields */ }
Expand description

A lending iterator that iterates over the elements of two iterators in sequence.

This struct is created by the chain method on LendingIterator. See its documentation for more.

Trait Implementations§

Source§

impl<A: Clone, B: Clone> Clone for Chain<A, B>

Source§

fn clone(&self) -> Chain<A, B>

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<A: Debug, B: Debug> Debug for Chain<A, B>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<A, B> LendingIterator for Chain<A, B>
where A: LendingIterator, for<'a> B: LendingIterator<Item<'a> = A::Item<'a>> + 'a,

Source§

type Item<'a> = <A as LendingIterator>::Item<'a> where Self: 'a

The type of the elements being iterated over.
Source§

fn next(&mut self) -> Option<A::Item<'_>>

Advances the lending iterator and returns the next value. Read more
Source§

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

Returns the bounds on the remaining length of the iterator. Read more
Source§

fn count(self) -> usize
where Self: Sized,

Returns the number of items in the lending iterator. Read more
Source§

fn advance_by(&mut self, n: usize) -> Result<(), NonZeroUsize>

Advances the lending iterator by n elements. Read more
Source§

fn nth(&mut self, n: usize) -> Option<Self::Item<'_>>

Returns the nth element of the lending iterator. Read more
Source§

fn step_by(self, step: usize) -> StepBy<Self>
where Self: Sized,

Creates a lending iterator starting at the same point, but stepping by the given amount at each iteration. Read more
Source§

fn take(self, n: usize) -> Take<Self>
where Self: Sized,

Creates a lending iterator that lends the first n elements, or fewer if the underlying iterator ends sooner. Read more
Source§

fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
where Self: Sized, P: for<'a> FnMut(&Self::Item<'a>) -> bool,

Creates a lending iterator that lends items matching a predicate. Read more
Source§

fn chain<I>(self, other: I) -> Chain<Self, I>
where Self: Sized, for<'a> I: LendingIterator<Item<'a> = Self::Item<'a>> + 'a,

Takes two lending iterators and creates a new lending iterator over both in sequence. Read more
Source§

fn zip<I>(self, other: I) -> Zip<Self, I>
where Self: Sized, I: LendingIterator,

‘Zips up’ two lending iterators into a single lending iterator of pairs.
Source§

fn map<F>(self, f: F) -> Map<Self, F>
where Self: Sized, F: for<'a> SingleArgFnMut<Self::Item<'a>>,

Takes a closure and creates a lending iterator which calls that closure on each element. Read more
Source§

fn for_each<F>(self, f: F)
where Self: Sized, F: FnMut(Self::Item<'_>),

Calls a closure on each element of the lending iterator. Read more
Source§

fn filter<P>(self, predicate: P) -> Filter<Self, P>
where Self: Sized, P: for<'a> FnMut(&Self::Item<'a>) -> bool,

Creates a lending iterator which uses a closure to determine if an element should be yielded. Read more
Source§

fn filter_map<F>(self, f: F) -> FilterMap<Self, F>
where Self: Sized, F: for<'a> SingleArgFnMut<Self::Item<'a>>, for<'a> <F as SingleArgFnOnce<Self::Item<'a>>>::Output: OptionTrait,

Creates a lending iterator that both filters and maps. Read more
Source§

fn fold<B, F>(self, init: B, f: F) -> B
where Self: Sized, F: FnMut(B, Self::Item<'_>) -> B,

Folds every element into an accumulator by applying an operation, returning the final result. Read more
Source§

fn cloned<T>(self) -> Cloned<Self>
where Self: Sized, for<'a> Self::Item<'a>: Deref<Target = T>, T: Clone,

Creates a lending iterator which clones all of its elements. Read more
Source§

fn copied<T>(self) -> Copied<Self>
where Self: Sized, for<'a> Self::Item<'a>: Deref<Target = T>, T: Copy,

Creates a lending iterator which copies all of its elements. Read more
Source§

fn enumerate(self) -> Enumerate<Self>
where Self: Sized,

Creates a lending iterator which gives the current iteration count as well as the next value.
Source§

fn skip(self, n: usize) -> Skip<Self>
where Self: Sized,

Creates a lending iterator that skips over the first n elements of self.
Source§

fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
where Self: Sized, P: for<'a> FnMut(&Self::Item<'a>) -> bool,

Creates a lending iterator that rejects elements while predicate returns true.
Source§

fn inspect<F>(self, f: F) -> Inspect<Self, F>
where Self: Sized, F: for<'a> FnMut(&Self::Item<'a>),

Creates a lending iterator that yields the current element unchanged, while calling a provided function with a reference to that element. Read more
Source§

fn scan<St, F>(self, initial_state: St, f: F) -> Scan<Self, St, F>
where Self: Sized,

Creates a lending iterator that yields elements transformed by a stateful closure. Read more
Source§

fn map_while<F>(self, f: F) -> MapWhile<Self, F>
where Self: Sized, F: for<'a> SingleArgFnMut<Self::Item<'a>>, for<'a> <F as SingleArgFnOnce<Self::Item<'a>>>::Output: OptionTrait,

Creates a lending iterator that yields elements while the predicate returns Some. Read more
Source§

fn fuse(self) -> Fuse<Self>
where Self: Sized,

Creates a lending iterator that yields None forever after the underlying iterator yields None once. Read more
Source§

fn cycle(self) -> Cycle<Self>
where Self: Sized + Clone,

Creates a lending iterator that repeats elements endlessly by cloning the iterator. Read more
Source§

fn by_ref(&mut self) -> &mut Self
where Self: Sized,

Borrows the lending iterator. Read more
Source§

fn all<P>(&mut self, predicate: P) -> bool
where P: FnMut(Self::Item<'_>) -> bool,

Tests if every element of the iterator matches a predicate.
Source§

fn any<P>(&mut self, predicate: P) -> bool
where P: FnMut(Self::Item<'_>) -> bool,

Tests if any element of the iterator matches a predicate.
Source§

fn is_partitioned<P>(self, predicate: P) -> bool
where Self: Sized, P: FnMut(Self::Item<'_>) -> bool,

Checks if the elements of this iterator are partitioned according to the given predicate, such that all those that return true precede all those that return false.
Source§

fn find<P>(&mut self, predicate: P) -> Option<Self::Item<'_>>
where P: FnMut(&Self::Item<'_>) -> bool,

Searches for an element of an iterator that satisfies a predicate.
Source§

fn find_map<B, F>(&mut self, f: F) -> Option<B>
where F: FnMut(Self::Item<'_>) -> Option<B>,

Applies function to the elements of iterator and returns the first non-none result.
Source§

fn position<P>(&mut self, predicate: P) -> Option<usize>
where P: FnMut(Self::Item<'_>) -> bool,

Searches for an element in an iterator, returning its index.
Source§

fn cmp<I>(self, other: I) -> Ordering
where I: for<'a> LendingIterator<Item<'a> = Self::Item<'a>>, for<'a> Self::Item<'a>: Ord, Self: Sized,

Lexicographically compares the elements of this Iterator with those of another.
Source§

fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
where Self: Sized, I: LendingIterator, F: FnMut(Self::Item<'_>, I::Item<'_>) -> Ordering,

Lexicographically compares the elements of this Iterator with those of another with respect to the specified comparison function.
Source§

fn partial_cmp<I>(self, other: I) -> Option<Ordering>
where I: LendingIterator, for<'a> Self::Item<'a>: PartialOrd<I::Item<'a>>, Self: Sized,

Lexicographically compares the PartialOrd elements of this Iterator with those of another. The comparison works like short-circuit evaluation, returning a result without comparing the remaining elements. As soon as an order can be determined, the evaluation stops and a result is returned.
Source§

fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>
where Self: Sized, I: LendingIterator, F: FnMut(Self::Item<'_>, I::Item<'_>) -> Option<Ordering>,

Lexicographically compares the elements of this Iterator with those of another with respect to the specified comparison function.
Source§

fn eq<I>(self, other: I) -> bool
where I: LendingIterator, for<'a> Self::Item<'a>: PartialEq<I::Item<'a>>, Self: Sized,

Determines if the elements of this Iterator are equal to those of another.
Source§

fn eq_by<I, F>(self, other: I, eq: F) -> bool
where Self: Sized, I: LendingIterator, F: FnMut(Self::Item<'_>, I::Item<'_>) -> bool,

Determines if the elements of this Iterator are equal to those of another with respect to the specified equality function.
Source§

fn ne<I>(self, other: I) -> bool
where I: LendingIterator, for<'a> Self::Item<'a>: PartialEq<I::Item<'a>>, Self: Sized,

Determines if the elements of this Iterator are not equal to those of another.
Source§

fn lt<I>(self, other: I) -> bool
where I: LendingIterator, for<'a> Self::Item<'a>: PartialOrd<I::Item<'a>>, Self: Sized,

Determines if the elements of this Iterator are lexicographically less than those of another.
Source§

fn le<I>(self, other: I) -> bool
where I: LendingIterator, for<'a> Self::Item<'a>: PartialOrd<I::Item<'a>>, Self: Sized,

Determines if the elements of this Iterator are lexicographically less or equal to those of another.
Source§

fn gt<I>(self, other: I) -> bool
where I: LendingIterator, for<'a> Self::Item<'a>: PartialOrd<I::Item<'a>>, Self: Sized,

Determines if the elements of this Iterator are lexicographically greater than those of another.
Source§

fn ge<I>(self, other: I) -> bool
where I: LendingIterator, for<'a> Self::Item<'a>: PartialOrd<I::Item<'a>>, Self: Sized,

Determines if the elements of this Iterator are lexicographically greater or equal to those of another.
Source§

fn reduce<B, F>(self, f: F) -> Option<B>
where Self: Sized, F: FnMut(B, Self::Item<'_>) -> B, B: for<'a> From<Self::Item<'a>>,

Reduces the elements to a single one, by repeatedly applying a reducing operation. Read more
Source§

fn try_fold<B, F, E>(&mut self, init: B, f: F) -> Result<B, E>
where Self: Sized, F: FnMut(B, Self::Item<'_>) -> Result<B, E>,

An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. Read more
Source§

fn try_for_each<F, E>(&mut self, f: F) -> Result<(), E>
where Self: Sized, F: FnMut(Self::Item<'_>) -> Result<(), E>,

An iterator method that applies a fallible function to each item in the iterator, stopping at the first error and returning that error. Read more
Source§

fn try_find<F, R>(&mut self, f: F) -> Result<Option<Self::Item<'_>>, R>
where Self: Sized, F: FnMut(&Self::Item<'_>) -> Result<bool, R>,

Applies function to the elements of iterator and returns the first true result or the first error. Read more
Source§

fn try_reduce<B, F, E>(self, f: F) -> Result<Option<B>, E>
where Self: Sized, F: FnMut(B, Self::Item<'_>) -> Result<B, E>, B: for<'a> From<Self::Item<'a>>,

Reduces the elements to a single one by repeatedly applying a reducing operation. If the closure returns a failure, the failure is propagated back to the caller immediately. Read more
Source§

fn max<T>(self) -> Option<T>
where Self: Sized, for<'a> T: for<'a> From<Self::Item<'a>> + PartialOrd<Self::Item<'a>>,

Returns the maximum element of an iterator. Read more
Source§

fn min<T>(self) -> Option<T>
where Self: Sized, for<'a> T: for<'a> From<Self::Item<'a>> + PartialOrd<Self::Item<'a>>,

Returns the minimum element of an iterator. Read more
Source§

fn max_by<T, F>(self, compare: F) -> Option<T>
where Self: Sized, F: for<'a> FnMut(&T, &Self::Item<'a>) -> Ordering, T: for<'a> From<Self::Item<'a>>,

Returns the element that gives the maximum value from the specified function. Read more
Source§

fn min_by<T, F>(self, compare: F) -> Option<T>
where Self: Sized, F: for<'a> FnMut(&T, &Self::Item<'a>) -> Ordering, T: for<'a> From<Self::Item<'a>>,

Returns the element that gives the minimum value from the specified function. Read more
Source§

fn max_by_key<T, B, F>(self, f: F) -> Option<T>
where Self: Sized, B: Ord, F: for<'a> FnMut(&Self::Item<'a>) -> B, T: for<'a> From<Self::Item<'a>>,

Returns the element that gives the maximum value with respect to the specified key function. Read more
Source§

fn min_by_key<T, B, F>(self, f: F) -> Option<T>
where Self: Sized, B: Ord, F: for<'a> FnMut(&Self::Item<'a>) -> B, T: for<'a> From<Self::Item<'a>>,

Returns the element that gives the minimum value with respect to the specified key function. Read more
Source§

fn sum<S>(self) -> S
where Self: Sized, for<'a> S: AddAssign<Self::Item<'a>> + Default,

Sums the elements of an iterator. Read more
Source§

fn product<P>(self) -> P
where Self: Sized, for<'a> P: MulAssign<Self::Item<'a>> + From<u8>,

Iterates over the entire iterator, multiplying all the elements Read more

Auto Trait Implementations§

§

impl<A, B> Freeze for Chain<A, B>
where A: Freeze, B: Freeze,

§

impl<A, B> RefUnwindSafe for Chain<A, B>

§

impl<A, B> Send for Chain<A, B>
where A: Send, B: Send,

§

impl<A, B> Sync for Chain<A, B>
where A: Sync, B: Sync,

§

impl<A, B> Unpin for Chain<A, B>
where A: Unpin, B: Unpin,

§

impl<A, B> UnwindSafe for Chain<A, B>
where A: UnwindSafe, B: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

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

The type returned in the event of a conversion error.
Source§

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

Performs the conversion.