pub struct Take<I: NonEmptyIterator> { /* private fields */ }Expand description
Represents non-empty iterators that only iterate over the first given number of items of the underlying iterator.
Implementations§
Trait Implementations§
Source§impl<I: NonEmptyIterator> IntoIterator for Take<I>
impl<I: NonEmptyIterator> IntoIterator for Take<I>
Source§impl<I: NonEmptyIterator> NonEmptyIterator for Take<I>
impl<I: NonEmptyIterator> NonEmptyIterator for Take<I>
Source§fn consume(self) -> (Self::Item, Self::IntoIter)
fn consume(self) -> (Self::Item, Self::IntoIter)
Consumes the non-empty iterator, returning the next item
along with the possibly empty iterator.
Source§fn enumerate(self) -> Enumerate<Self>
fn enumerate(self) -> Enumerate<Self>
Creates non-empty iterators that yield the current count and the item during iteration. Read more
Source§fn peeked(self) -> Peeked<Self::IntoIter>
fn peeked(self) -> Peeked<Self::IntoIter>
Peeks at the next item of the non-empty iterator, returning it along
with the possibly empty iterator. Read more
Source§fn chain<I: IntoIterator<Item = Self::Item>>(
self,
other: I,
) -> Chain<Self, I::IntoIter>
fn chain<I: IntoIterator<Item = Self::Item>>( self, other: I, ) -> Chain<Self, I::IntoIter>
Links the non-empty iterator with the provided possibly empty iterator. Read more
Source§fn cloned<'a, T>(self) -> Cloned<Self>
fn cloned<'a, T>(self) -> Cloned<Self>
Creates non-empty iterators that clone the items of the underlying non-empty iterator. Read more
Source§fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
Creates non-empty iterators that copy the items of the underlying non-empty iterator. Read more
Source§fn zip<I: IntoNonEmptyIterator>(
self,
other: I,
) -> Zip<Self, I::IntoNonEmptyIter>
fn zip<I: IntoNonEmptyIterator>( self, other: I, ) -> Zip<Self, I::IntoNonEmptyIter>
Zips the non-empty iterator with the provided non-empty iterator. Read more
Source§fn sum<S: Sum<Self::Item>>(self) -> S
fn sum<S: Sum<Self::Item>>(self) -> S
Sums the items of the non-empty iterator together. Read more
Source§fn product<P: Product<Self::Item>>(self) -> P
fn product<P: Product<Self::Item>>(self) -> P
Multiplies the items of the non-empty iterator together. Read more
Source§fn all<P: FnMut(Self::Item) -> bool>(self, predicate: P) -> bool
fn all<P: FnMut(Self::Item) -> bool>(self, predicate: P) -> bool
Tests whether all items of the non-empty iterator match the predicate. Read more
Source§fn any<P: FnMut(Self::Item) -> bool>(self, predicate: P) -> bool
fn any<P: FnMut(Self::Item) -> bool>(self, predicate: P) -> bool
Tests whether any items of the non-empty iterator match the predicate. Read more
Source§fn none<P: FnMut(Self::Item) -> bool>(self, predicate: P) -> bool
fn none<P: FnMut(Self::Item) -> bool>(self, predicate: P) -> bool
Tests whether no items of the non-empty iterator match the predicate. Read more
Source§fn reduce<F>(self, function: F) -> Self::Item
fn reduce<F>(self, function: F) -> Self::Item
Reduces the items of the non-empty iterator into the single one
by repeatedly applying the given function. Read more
Source§fn unzip<T, U, C: Default + Extend<T>, D: Default + Extend<U>>(self) -> (C, D)where
Self: NonEmptyIterator<Item = (T, U)>,
fn unzip<T, U, C: Default + Extend<T>, D: Default + Extend<U>>(self) -> (C, D)where
Self: NonEmptyIterator<Item = (T, U)>,
Converts the non-empty iterator of pairs into the pair of collections. Read more
Source§fn collect<C: FromIterator<Self::Item>>(self) -> C
fn collect<C: FromIterator<Self::Item>>(self) -> C
Source§fn collect_non_empty<C: FromNonEmptyIterator<Self::Item>>(self) -> C
fn collect_non_empty<C: FromNonEmptyIterator<Self::Item>>(self) -> C
Collects the items of the non-empty iterator into the collection. Read more
Source§fn flat_map<J: IntoNonEmptyIterator, F: FnMut(Self::Item) -> J>(
self,
function: F,
) -> FlatMap<Self, J, F>
fn flat_map<J: IntoNonEmptyIterator, F: FnMut(Self::Item) -> J>( self, function: F, ) -> FlatMap<Self, J, F>
Source§fn flatten(self) -> Flatten<Self>where
Self::Item: IntoNonEmptyIterator,
fn flatten(self) -> Flatten<Self>where
Self::Item: IntoNonEmptyIterator,
Flattens one level of nesting in
self non-empty iterator. Read moreSource§fn filter_map<T, F: FnMut(Self::Item) -> Option<T>>(
self,
function: F,
) -> FilterMap<Self::IntoIter, F>
fn filter_map<T, F: FnMut(Self::Item) -> Option<T>>( self, function: F, ) -> FilterMap<Self::IntoIter, F>
Source§fn map<U, F: FnMut(Self::Item) -> U>(self, function: F) -> Map<Self, F>
fn map<U, F: FnMut(Self::Item) -> U>(self, function: F) -> Map<Self, F>
Creates non-empty iterators that map the items of the non-empty iterator with the function. Read more
Source§fn max_by<F: FnMut(&Self::Item, &Self::Item) -> Ordering>(
self,
function: F,
) -> Self::Item
fn max_by<F: FnMut(&Self::Item, &Self::Item) -> Ordering>( self, function: F, ) -> Self::Item
Returns the maximum item of the non-empty iterator with respect to the comparison function. Read more
Source§fn max_by_key<K: Ord, F: FnMut(&Self::Item) -> K>(
self,
function: F,
) -> Self::Item
fn max_by_key<K: Ord, F: FnMut(&Self::Item) -> K>( self, function: F, ) -> Self::Item
Returns the maximum item of the non-empty iterator with respect to the key function. Read more
Source§fn min_by<F: FnMut(&Self::Item, &Self::Item) -> Ordering>(
self,
function: F,
) -> Self::Item
fn min_by<F: FnMut(&Self::Item, &Self::Item) -> Ordering>( self, function: F, ) -> Self::Item
Returns the minimum item of the non-empty iterator with respect to the comparison function. Read more
Source§fn min_by_key<K: Ord, F: FnMut(&Self::Item) -> K>(
self,
function: F,
) -> Self::Item
fn min_by_key<K: Ord, F: FnMut(&Self::Item) -> K>( self, function: F, ) -> Self::Item
Returns the minimum item of the non-empty iterator with respect to the key function. Read more
Source§fn nth(self, n: Size) -> Option<Self::Item>
fn nth(self, n: Size) -> Option<Self::Item>
Returns the
n-th item of the non-empty iterator. Read moreSource§fn skip(self, count: Size) -> Skip<Self::IntoIter>
fn skip(self, count: Size) -> Skip<Self::IntoIter>
Skips the first given number of items in the non-empty iterator. Read more
Source§fn take(self, count: Size) -> Take<Self>
fn take(self, count: Size) -> Take<Self>
Takes only the first given number of items from the non-empty iterator. Read more
Source§fn step_by(self, step: Size) -> StepBy<Self>
fn step_by(self, step: Size) -> StepBy<Self>
Steps the non-empty iterator by the given custom amount. Read more
Source§fn skip_while<P: FnMut(&Self::Item) -> bool>(
self,
predicate: P,
) -> SkipWhile<Self::IntoIter, P>
fn skip_while<P: FnMut(&Self::Item) -> bool>( self, predicate: P, ) -> SkipWhile<Self::IntoIter, P>
Source§fn take_while<P: FnMut(&Self::Item) -> bool>(
self,
predicate: P,
) -> TakeWhile<Self::IntoIter, P>
fn take_while<P: FnMut(&Self::Item) -> bool>( self, predicate: P, ) -> TakeWhile<Self::IntoIter, P>
Source§fn map_while<T, P: FnMut(Self::Item) -> Option<T>>(
self,
predicate: P,
) -> MapWhile<Self::IntoIter, P>
fn map_while<T, P: FnMut(Self::Item) -> Option<T>>( self, predicate: P, ) -> MapWhile<Self::IntoIter, P>
Source§fn scan<S, T, F: FnMut(&mut S, Self::Item) -> Option<T>>(
self,
initial: S,
function: F,
) -> Scan<Self::IntoIter, S, F>
fn scan<S, T, F: FnMut(&mut S, Self::Item) -> Option<T>>( self, initial: S, function: F, ) -> Scan<Self::IntoIter, S, F>
Source§fn inspect<F: FnMut(&Self::Item)>(self, function: F) -> Inspect<Self, F>
fn inspect<F: FnMut(&Self::Item)>(self, function: F) -> Inspect<Self, F>
Creates non-empty iterators that call the provided function with references to each item. Read more
Source§fn partition<C: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool>(
self,
function: F,
) -> (C, C)
fn partition<C: Default + Extend<Self::Item>, F: FnMut(&Self::Item) -> bool>( self, function: F, ) -> (C, C)
Source§fn partial_cmp<I: IntoIterator>(self, other: I) -> Option<Ordering>
fn partial_cmp<I: IntoIterator>(self, other: I) -> Option<Ordering>
Equivalent to
partial_cmp on Iterator.Source§fn eq<I: IntoIterator>(self, other: I) -> bool
fn eq<I: IntoIterator>(self, other: I) -> bool
Source§fn ne<I: IntoIterator>(self, other: I) -> bool
fn ne<I: IntoIterator>(self, other: I) -> bool
Source§fn lt<I: IntoIterator>(self, other: I) -> bool
fn lt<I: IntoIterator>(self, other: I) -> bool
Source§fn le<I: IntoIterator>(self, other: I) -> bool
fn le<I: IntoIterator>(self, other: I) -> bool
Source§fn gt<I: IntoIterator>(self, other: I) -> bool
fn gt<I: IntoIterator>(self, other: I) -> bool
Source§fn ge<I: IntoIterator>(self, other: I) -> bool
fn ge<I: IntoIterator>(self, other: I) -> bool
Source§fn is_sorted_by<F: FnMut(&Self::Item, &Self::Item) -> bool>(
self,
function: F,
) -> bool
fn is_sorted_by<F: FnMut(&Self::Item, &Self::Item) -> bool>( self, function: F, ) -> bool
Equivalent to
is_sorted_by on Iterator.Source§fn is_sorted_by_key<K: PartialOrd, F: FnMut(Self::Item) -> K>(
self,
function: F,
) -> bool
fn is_sorted_by_key<K: PartialOrd, F: FnMut(Self::Item) -> K>( self, function: F, ) -> bool
Equivalent to
is_sorted_by_key on Iterator.Auto Trait Implementations§
impl<I> Freeze for Take<I>where
I: Freeze,
impl<I> RefUnwindSafe for Take<I>where
I: RefUnwindSafe,
impl<I> Send for Take<I>where
I: Send,
impl<I> Sync for Take<I>where
I: Sync,
impl<I> Unpin for Take<I>where
I: Unpin,
impl<I> UnwindSafe for Take<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<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<I> IntoNonEmptyIterator for Iwhere
I: NonEmptyIterator,
impl<I> IntoNonEmptyIterator for Iwhere
I: NonEmptyIterator,
Source§type IntoNonEmptyIter = I
type IntoNonEmptyIter = I
What kind of
NonEmptyIterator are we turning this into?Source§fn into_non_empty_iter(self) -> <I as IntoNonEmptyIterator>::IntoNonEmptyIter
fn into_non_empty_iter(self) -> <I as IntoNonEmptyIterator>::IntoNonEmptyIter
Converts
self into NonEmptyIterator.Source§impl<I> TryIntoNonEmptyIterator for Iwhere
I: IntoIterator,
impl<I> TryIntoNonEmptyIterator for Iwhere
I: IntoIterator,
Source§type Item = <I as IntoIterator>::Item
type Item = <I as IntoIterator>::Item
The type of the items being iterated over.
Source§type IntoNonEmptyIter = NonEmptyAdapter<Peekable<<I as IntoIterator>::IntoIter>>
type IntoNonEmptyIter = NonEmptyAdapter<Peekable<<I as IntoIterator>::IntoIter>>
Which kind of
NonEmptyIterator are we turning this into?