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

A non-empty iterator that links two iterators together, in a chain.

Trait Implementations§

source§

impl<A, B> IntoIterator for Chain<A, B>
where A: IntoIterator, B: IntoIterator<Item = A::Item>,

§

type Item = <A as IntoIterator>::Item

The type of the elements being iterated over.
§

type IntoIter = Chain<<A as IntoIterator>::IntoIter, <B as IntoIterator>::IntoIter>

Which kind of iterator are we turning this into?
source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
source§

impl<A, B> NonEmptyIterator for Chain<A, B>
where A: NonEmptyIterator, B: Iterator<Item = A::Item>,

§

type Item = <A as NonEmptyIterator>::Item

The value produced by this iterator.
§

type IntoIter = Chain<<<A as NonEmptyIterator>::IntoIter as IntoIterator>::IntoIter, B>

Each NonEmptyIterator knows about a possibly-empty variant of itself, likely from std. Critically, they share an Item.
source§

fn first(self) -> (Self::Item, Self::IntoIter)

A NonEmptyIterator can, by consuming itself, reliably produce its first element, alongside its possibly-empty variant.
source§

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

Advances the iterator and returns the next value. Read more
source§

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

Tests if every element of the iterator matches a predicate. Read more
source§

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

Tests if any element of the iterator matches a predicate. Read more
source§

fn chain<U>(self, other: U) -> Chain<Self, U::IntoIter>
where Self: Sized, U: IntoIterator<Item = Self::Item>,

Takes two iterators and creates a new non-empty iterator over both in sequence. Read more
source§

fn cloned<'a, T>(self) -> Cloned<Self>
where Self: Sized + NonEmptyIterator<Item = &'a T>, T: Clone + 'a,

Creates a non-empty iterator which clones all of its elements. Read more
source§

fn collect<B>(self) -> B
where Self: Sized, B: FromNonEmptyIterator<Self::Item>,

Transforms an iterator into a collection, or some other concrete value. Read more
source§

fn copied<'a, T>(self) -> Copied<Self>
where Self: Sized + NonEmptyIterator<Item = &'a T>, T: Copy + 'a,

Creates a non-empty iterator which copies all of its elements. Read more
source§

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

Consumes the non-empty iterator, counting the number of iterations and returning it. Read more
source§

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

Creates a non-empty iterator which gives the current iteration count as well as the next value. Read more
source§

fn flat_map<U, V, F>(self, f: F) -> FlatMap<Self, V, F>
where Self: Sized, F: FnMut(Self::Item) -> U, U: IntoNonEmptyIterator<IntoIter = V, Item = V::Item>, V: NonEmptyIterator,

Creates an iterator that works like map, but flattens nested, non-empty structure. 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 map<U, F>(self, f: F) -> Map<Self, F>
where Self: Sized, F: FnMut(Self::Item) -> U,

Takes a closure and creates a non-empty iterator which calls that closure on each element. Read more
source§

fn max_by<F>(self, compare: F) -> Self::Item
where Self: Sized, F: Fn(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the maximum value with respect to the given comparison function. Read more
source§

fn max_by_key<B, F>(self, key: F) -> Self::Item
where Self: Sized, B: Ord, F: FnMut(&Self::Item) -> B,

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

fn min_by<F>(self, compare: F) -> Self::Item
where Self: Sized, F: Fn(&Self::Item, &Self::Item) -> Ordering,

Returns the element that gives the minimum value with respect to the given comparison function. Read more
source§

fn min_by_key<B, F>(self, key: F) -> Self::Item
where Self: Sized, B: Ord, F: FnMut(&Self::Item) -> B,

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

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

Returns the nth element of the iterator. Read more
source§

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

Iterates over the first n elements, or fewer if the underlying iterator ends sooner. Read more
source§

fn zip<U>(self, other: U) -> Zip<Self, U::IntoIter>
where Self: Sized, U: IntoNonEmptyIterator,

“Zips up” two non-empty iterators into a single one, while preserving non-emptiness. Read more
source§

fn reduce<F>(self, f: F) -> Self::Item
where Self: Sized, F: FnMut(Self::Item, Self::Item) -> Self::Item,

Reduces the elements to a single one, by repeatedly applying a reducing operation. 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> 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> IntoIteratorExt for T
where T: IntoIterator,

source§

fn try_into_nonempty_iter(self) -> Option<<T as IntoIteratorExt>::IntoIter>

Tries to convert self into NonEmptyIterator. Calls self.next() once. If self doesn’t return Some upon the first call to next(), returns None.

§

type Item = <T as IntoIterator>::Item

The type of the elements being iterated over.
§

type IntoIter = Chain<Once<<T as IntoIteratorExt>::Item>, <T as IntoIterator>::IntoIter>

Which kind of NonEmptyIterator are we turning this into?
source§

impl<I> IntoNonEmptyIterator for I

§

type Item = <I as NonEmptyIterator>::Item

The type of the elements being iterated over.
§

type IntoIter = I

Which kind of NonEmptyIterator are we turning this into?
source§

fn into_nonempty_iter(self) -> <I as IntoNonEmptyIterator>::IntoIter

Creates a NonEmptyIterator from a value.
source§

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

§

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>,

§

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.