Struct itertools::structs::Combinations
source · pub struct Combinations<I: Iterator> {
indices: Vec<usize>,
pool: LazyBuffer<I>,
first: bool,
}
Expand description
An iterator to iterate through all the k
-length combinations in an iterator.
See .combinations()
for more information.
Fields§
§indices: Vec<usize>
§pool: LazyBuffer<I>
§first: bool
Implementations§
source§impl<I: Iterator> Combinations<I>
impl<I: Iterator> Combinations<I>
sourcepub fn n(&self) -> usize
pub fn n(&self) -> usize
Returns the (current) length of the pool from which combination elements are
selected. This value can change between invocations of next
.
sourcepub(crate) fn src(&self) -> &LazyBuffer<I>
pub(crate) fn src(&self) -> &LazyBuffer<I>
Returns a reference to the source pool.
sourcepub(crate) fn reset(&mut self, k: usize)
pub(crate) fn reset(&mut self, k: usize)
Resets this Combinations
back to an initial state for combinations of length
k
over the same pool data source. If k
is larger than the current length
of the data pool an attempt is made to prefill the pool so that it holds k
elements.
pub(crate) fn n_and_count(self) -> (usize, usize)
sourcefn init(&mut self) -> bool
fn init(&mut self) -> bool
Initialises the iterator by filling a buffer with elements from the iterator. Returns true if there are no combinations, false otherwise.
sourcefn increment_indices(&mut self) -> bool
fn increment_indices(&mut self) -> bool
Increments indices representing the combination to advance to the next
(in lexicographic order by increasing sequence) combination. For example
if we have n=4 & k=2 then [0, 1] -> [0, 2] -> [0, 3] -> [1, 2] -> ...
Returns true if we’ve run out of combinations, false otherwise.
Trait Implementations§
source§impl<I> Clone for Combinations<I>
impl<I> Clone for Combinations<I>
source§impl<I> Debug for Combinations<I>
impl<I> Debug for Combinations<I>
source§impl<I> Iterator for Combinations<I>
impl<I> Iterator for Combinations<I>
source§fn next(&mut self) -> Option<Self::Item>
fn next(&mut self) -> Option<Self::Item>
source§fn nth(&mut self, n: usize) -> Option<Self::Item>
fn nth(&mut self, n: usize) -> Option<Self::Item>
n
th element of the iterator. Read moresource§fn size_hint(&self) -> (usize, Option<usize>)
fn size_hint(&self) -> (usize, Option<usize>)
source§fn count(self) -> usize
fn count(self) -> usize
source§fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
fn next_chunk<const N: usize>(
&mut self,
) -> Result<[Self::Item; N], IntoIter<Self::Item, N>>where
Self: Sized,
iter_next_chunk
)N
values. Read more1.0.0 · source§fn last(self) -> Option<Self::Item>where
Self: Sized,
fn last(self) -> Option<Self::Item>where
Self: Sized,
source§fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
fn advance_by(&mut self, n: usize) -> Result<(), NonZero<usize>>
iter_advance_by
)n
elements. Read more1.28.0 · source§fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
fn step_by(self, step: usize) -> StepBy<Self>where
Self: Sized,
1.0.0 · source§fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
fn chain<U>(self, other: U) -> Chain<Self, <U as IntoIterator>::IntoIter>
1.0.0 · source§fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
fn zip<U>(self, other: U) -> Zip<Self, <U as IntoIterator>::IntoIter>where
Self: Sized,
U: IntoIterator,
source§fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
fn intersperse_with<G>(self, separator: G) -> IntersperseWith<Self, G>
iter_intersperse
)separator
between adjacent items of the original iterator. Read more1.0.0 · source§fn map<B, F>(self, f: F) -> Map<Self, F>
fn map<B, F>(self, f: F) -> Map<Self, F>
1.0.0 · source§fn filter<P>(self, predicate: P) -> Filter<Self, P>
fn filter<P>(self, predicate: P) -> Filter<Self, P>
1.0.0 · source§fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
fn filter_map<B, F>(self, f: F) -> FilterMap<Self, F>
1.0.0 · source§fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
fn enumerate(self) -> Enumerate<Self>where
Self: Sized,
1.0.0 · source§fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
fn skip_while<P>(self, predicate: P) -> SkipWhile<Self, P>
1.0.0 · source§fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
fn take_while<P>(self, predicate: P) -> TakeWhile<Self, P>
1.57.0 · source§fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
fn map_while<B, P>(self, predicate: P) -> MapWhile<Self, P>
1.0.0 · source§fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
fn skip(self, n: usize) -> Skip<Self>where
Self: Sized,
n
elements. Read more1.0.0 · source§fn take(self, n: usize) -> Take<Self>where
Self: Sized,
fn take(self, n: usize) -> Take<Self>where
Self: Sized,
n
elements, or fewer
if the underlying iterator ends sooner. Read more1.0.0 · source§fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
fn flat_map<U, F>(self, f: F) -> FlatMap<Self, U, F>
source§fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
fn map_windows<F, R, const N: usize>(self, f: F) -> MapWindows<Self, F, N>
iter_map_windows
)f
for each contiguous window of size N
over
self
and returns an iterator over the outputs of f
. Like slice::windows()
,
the windows during mapping overlap as well. Read more1.0.0 · source§fn inspect<F>(self, f: F) -> Inspect<Self, F>
fn inspect<F>(self, f: F) -> Inspect<Self, F>
1.0.0 · source§fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
fn by_ref(&mut self) -> &mut Selfwhere
Self: Sized,
source§fn collect_into<E>(self, collection: &mut E) -> &mut E
fn collect_into<E>(self, collection: &mut E) -> &mut E
iter_collect_into
)1.0.0 · source§fn partition<B, F>(self, f: F) -> (B, B)
fn partition<B, F>(self, f: F) -> (B, B)
source§fn is_partitioned<P>(self, predicate: P) -> bool
fn is_partitioned<P>(self, predicate: P) -> bool
iter_is_partitioned
)true
precede all those that return false
. Read more1.27.0 · source§fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
fn try_fold<B, F, R>(&mut self, init: B, f: F) -> R
1.27.0 · source§fn try_for_each<F, R>(&mut self, f: F) -> R
fn try_for_each<F, R>(&mut self, f: F) -> R
1.0.0 · source§fn fold<B, F>(self, init: B, f: F) -> B
fn fold<B, F>(self, init: B, f: F) -> B
1.51.0 · source§fn reduce<F>(self, f: F) -> Option<Self::Item>
fn reduce<F>(self, f: F) -> Option<Self::Item>
source§fn try_reduce<F, R>(
&mut self,
f: F,
) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
fn try_reduce<F, R>( &mut self, f: F, ) -> <<R as Try>::Residual as Residual<Option<<R as Try>::Output>>>::TryType
iterator_try_reduce
)1.0.0 · source§fn all<F>(&mut self, f: F) -> bool
fn all<F>(&mut self, f: F) -> bool
1.0.0 · source§fn any<F>(&mut self, f: F) -> bool
fn any<F>(&mut self, f: F) -> bool
1.0.0 · source§fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
fn find<P>(&mut self, predicate: P) -> Option<Self::Item>
1.30.0 · source§fn find_map<B, F>(&mut self, f: F) -> Option<B>
fn find_map<B, F>(&mut self, f: F) -> Option<B>
source§fn try_find<F, R>(
&mut self,
f: F,
) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
fn try_find<F, R>( &mut self, f: F, ) -> <<R as Try>::Residual as Residual<Option<Self::Item>>>::TryType
try_find
)1.0.0 · source§fn position<P>(&mut self, predicate: P) -> Option<usize>
fn position<P>(&mut self, predicate: P) -> Option<usize>
1.6.0 · source§fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn max_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 · source§fn max_by<F>(self, compare: F) -> Option<Self::Item>
fn max_by<F>(self, compare: F) -> Option<Self::Item>
1.6.0 · source§fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
fn min_by_key<B, F>(self, f: F) -> Option<Self::Item>
1.15.0 · source§fn min_by<F>(self, compare: F) -> Option<Self::Item>
fn min_by<F>(self, compare: F) -> Option<Self::Item>
1.0.0 · source§fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
fn unzip<A, B, FromA, FromB>(self) -> (FromA, FromB)
1.36.0 · source§fn copied<'a, T>(self) -> Copied<Self>
fn copied<'a, T>(self) -> Copied<Self>
source§fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
fn array_chunks<const N: usize>(self) -> ArrayChunks<Self, N>where
Self: Sized,
iter_array_chunks
)N
elements of the iterator at a time. Read more1.11.0 · source§fn product<P>(self) -> P
fn product<P>(self) -> P
source§fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
fn cmp_by<I, F>(self, other: I, cmp: F) -> Ordering
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read more1.5.0 · source§fn partial_cmp<I>(self, other: I) -> Option<Ordering>
fn partial_cmp<I>(self, other: I) -> Option<Ordering>
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. Read moresource§fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
fn partial_cmp_by<I, F>(self, other: I, partial_cmp: F) -> Option<Ordering>where
Self: Sized,
I: IntoIterator,
F: FnMut(Self::Item, <I as IntoIterator>::Item) -> Option<Ordering>,
iter_order_by
)Iterator
with those
of another with respect to the specified comparison function. Read moresource§fn eq_by<I, F>(self, other: I, eq: F) -> bool
fn eq_by<I, F>(self, other: I, eq: F) -> bool
iter_order_by
)1.5.0 · source§fn lt<I>(self, other: I) -> bool
fn lt<I>(self, other: I) -> bool
Iterator
are lexicographically
less than those of another. Read more1.5.0 · source§fn le<I>(self, other: I) -> bool
fn le<I>(self, other: I) -> bool
Iterator
are lexicographically
less or equal to those of another. Read more1.5.0 · source§fn gt<I>(self, other: I) -> bool
fn gt<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than those of another. Read more1.5.0 · source§fn ge<I>(self, other: I) -> bool
fn ge<I>(self, other: I) -> bool
Iterator
are lexicographically
greater than or equal to those of another. Read moresource§fn is_sorted_by<F>(self, compare: F) -> bool
fn is_sorted_by<F>(self, compare: F) -> bool
is_sorted
)source§fn is_sorted_by_key<F, K>(self, f: F) -> bool
fn is_sorted_by_key<F, K>(self, f: F) -> bool
is_sorted
)impl<I> FusedIterator for Combinations<I>
Auto Trait Implementations§
impl<I> Freeze for Combinations<I>where
I: Freeze,
impl<I> RefUnwindSafe for Combinations<I>
impl<I> Send for Combinations<I>
impl<I> Sync for Combinations<I>
impl<I> Unpin for Combinations<I>
impl<I> UnwindSafe for Combinations<I>
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
source§impl<T> IntoEither for T
impl<T> IntoEither for T
source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moresource§impl<I> IntoIterator for Iwhere
I: Iterator,
impl<I> IntoIterator for Iwhere
I: Iterator,
source§impl<T> Itertools for T
impl<T> Itertools for T
source§fn interleave<J>(self, other: J) -> Interleave<Self, J::IntoIter> ⓘ
fn interleave<J>(self, other: J) -> Interleave<Self, J::IntoIter> ⓘ
source§fn interleave_shortest<J>(
self,
other: J,
) -> InterleaveShortest<Self, J::IntoIter> ⓘ
fn interleave_shortest<J>( self, other: J, ) -> InterleaveShortest<Self, J::IntoIter> ⓘ
source§fn intersperse(self, element: Self::Item) -> Intersperse<Self>
fn intersperse(self, element: Self::Item) -> Intersperse<Self>
source§fn intersperse_with<F>(self, element: F) -> IntersperseWith<Self, F> ⓘ
fn intersperse_with<F>(self, element: F) -> IntersperseWith<Self, F> ⓘ
source§fn get<R>(self, index: R) -> R::Outputwhere
Self: Sized,
R: IteratorIndex<Self>,
fn get<R>(self, index: R) -> R::Outputwhere
Self: Sized,
R: IteratorIndex<Self>,
source§fn zip_longest<J>(self, other: J) -> ZipLongest<Self, J::IntoIter> ⓘwhere
J: IntoIterator,
Self: Sized,
fn zip_longest<J>(self, other: J) -> ZipLongest<Self, J::IntoIter> ⓘwhere
J: IntoIterator,
Self: Sized,
source§fn zip_eq<J>(self, other: J) -> ZipEq<Self, J::IntoIter> ⓘwhere
J: IntoIterator,
Self: Sized,
fn zip_eq<J>(self, other: J) -> ZipEq<Self, J::IntoIter> ⓘwhere
J: IntoIterator,
Self: Sized,
source§fn batching<B, F>(self, f: F) -> Batching<Self, F> ⓘ
fn batching<B, F>(self, f: F) -> Batching<Self, F> ⓘ
source§fn chunk_by<K, F>(self, key: F) -> ChunkBy<K, Self, F>
fn chunk_by<K, F>(self, key: F) -> ChunkBy<K, Self, F>
source§fn group_by<K, F>(self, key: F) -> ChunkBy<K, Self, F>
fn group_by<K, F>(self, key: F) -> ChunkBy<K, Self, F>
.chunk_by()
.source§fn chunks(self, size: usize) -> IntoChunks<Self>where
Self: Sized,
fn chunks(self, size: usize) -> IntoChunks<Self>where
Self: Sized,
source§fn tuple_windows<T>(self) -> TupleWindows<Self, T> ⓘ
fn tuple_windows<T>(self) -> TupleWindows<Self, T> ⓘ
source§fn circular_tuple_windows<T>(self) -> CircularTupleWindows<Self, T> ⓘwhere
Self: Sized + Clone + Iterator<Item = T::Item> + ExactSizeIterator,
T: TupleCollect + Clone,
T::Item: Clone,
fn circular_tuple_windows<T>(self) -> CircularTupleWindows<Self, T> ⓘwhere
Self: Sized + Clone + Iterator<Item = T::Item> + ExactSizeIterator,
T: TupleCollect + Clone,
T::Item: Clone,
source§fn tuples<T>(self) -> Tuples<Self, T> ⓘ
fn tuples<T>(self) -> Tuples<Self, T> ⓘ
source§fn tee(self) -> (Tee<Self>, Tee<Self>)
fn tee(self) -> (Tee<Self>, Tee<Self>)
source§fn map_ok<F, T, U, E>(self, f: F) -> MapOk<Self, F>
fn map_ok<F, T, U, E>(self, f: F) -> MapOk<Self, F>
Result::Ok
value. Result::Err
values are
unchanged. Read moresource§fn filter_ok<F, T, E>(self, f: F) -> FilterOk<Self, F> ⓘ
fn filter_ok<F, T, E>(self, f: F) -> FilterOk<Self, F> ⓘ
Result::Ok
value with the provided closure. Result::Err
values are
unchanged. Read moresource§fn filter_map_ok<F, T, U, E>(self, f: F) -> FilterMapOk<Self, F> ⓘ
fn filter_map_ok<F, T, U, E>(self, f: F) -> FilterMapOk<Self, F> ⓘ
Result::Ok
value with the provided closure. Result::Err
values are unchanged. Read moresource§fn flatten_ok<T, E>(self) -> FlattenOk<Self, T, E> ⓘ
fn flatten_ok<T, E>(self) -> FlattenOk<Self, T, E> ⓘ
Result::Ok
value into
a series of Result::Ok
values. Result::Err
values are unchanged. Read moresource§fn process_results<F, T, E, R>(self, processor: F) -> Result<R, E>
fn process_results<F, T, E, R>(self, processor: F) -> Result<R, E>
Result
values instead. Read moresource§fn merge<J>(self, other: J) -> Merge<Self, J::IntoIter>
fn merge<J>(self, other: J) -> Merge<Self, J::IntoIter>
source§fn merge_join_by<J, F, T>(
self,
other: J,
cmp_fn: F,
) -> MergeJoinBy<Self, J::IntoIter, F>
fn merge_join_by<J, F, T>( self, other: J, cmp_fn: F, ) -> MergeJoinBy<Self, J::IntoIter, F>
source§fn kmerge(self) -> KMerge<<Self::Item as IntoIterator>::IntoIter>
fn kmerge(self) -> KMerge<<Self::Item as IntoIterator>::IntoIter>
source§fn kmerge_by<F>(
self,
first: F,
) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, F> ⓘwhere
Self: Sized,
Self::Item: IntoIterator,
F: FnMut(&<Self::Item as IntoIterator>::Item, &<Self::Item as IntoIterator>::Item) -> bool,
fn kmerge_by<F>(
self,
first: F,
) -> KMergeBy<<Self::Item as IntoIterator>::IntoIter, F> ⓘwhere
Self: Sized,
Self::Item: IntoIterator,
F: FnMut(&<Self::Item as IntoIterator>::Item, &<Self::Item as IntoIterator>::Item) -> bool,
source§fn cartesian_product<J>(self, other: J) -> Product<Self, J::IntoIter> ⓘ
fn cartesian_product<J>(self, other: J) -> Product<Self, J::IntoIter> ⓘ
self
and J
. Read moresource§fn multi_cartesian_product(
self,
) -> MultiProduct<<Self::Item as IntoIterator>::IntoIter> ⓘwhere
Self: Sized,
Self::Item: IntoIterator,
<Self::Item as IntoIterator>::IntoIter: Clone,
<Self::Item as IntoIterator>::Item: Clone,
fn multi_cartesian_product(
self,
) -> MultiProduct<<Self::Item as IntoIterator>::IntoIter> ⓘwhere
Self: Sized,
Self::Item: IntoIterator,
<Self::Item as IntoIterator>::IntoIter: Clone,
<Self::Item as IntoIterator>::Item: Clone,
self
. Read moresource§fn coalesce<F>(self, f: F) -> Coalesce<Self, F>
fn coalesce<F>(self, f: F) -> Coalesce<Self, F>
source§fn dedup(self) -> Dedup<Self>
fn dedup(self) -> Dedup<Self>
source§fn dedup_by<Cmp>(self, cmp: Cmp) -> DedupBy<Self, Cmp>
fn dedup_by<Cmp>(self, cmp: Cmp) -> DedupBy<Self, Cmp>
source§fn dedup_with_count(self) -> DedupWithCount<Self>where
Self: Sized,
fn dedup_with_count(self) -> DedupWithCount<Self>where
Self: Sized,
source§fn dedup_by_with_count<Cmp>(self, cmp: Cmp) -> DedupByWithCount<Self, Cmp>
fn dedup_by_with_count<Cmp>(self, cmp: Cmp) -> DedupByWithCount<Self, Cmp>
source§fn duplicates(self) -> Duplicates<Self>
fn duplicates(self) -> Duplicates<Self>
source§fn duplicates_by<V, F>(self, f: F) -> DuplicatesBy<Self, V, F>
fn duplicates_by<V, F>(self, f: F) -> DuplicatesBy<Self, V, F>
source§fn unique(self) -> Unique<Self> ⓘ
fn unique(self) -> Unique<Self> ⓘ
source§fn unique_by<V, F>(self, f: F) -> UniqueBy<Self, V, F> ⓘ
fn unique_by<V, F>(self, f: F) -> UniqueBy<Self, V, F> ⓘ
source§fn peeking_take_while<F>(&mut self, accept: F) -> PeekingTakeWhile<'_, Self, F> ⓘ
fn peeking_take_while<F>(&mut self, accept: F) -> PeekingTakeWhile<'_, Self, F> ⓘ
accept
returns true
. Read moresource§fn take_while_ref<F>(&mut self, accept: F) -> TakeWhileRef<'_, Self, F> ⓘ
fn take_while_ref<F>(&mut self, accept: F) -> TakeWhileRef<'_, Self, F> ⓘ
Clone
-able iterator
to only pick off elements while the predicate accept
returns true
. Read moresource§fn take_while_inclusive<F>(self, accept: F) -> TakeWhileInclusive<Self, F> ⓘ
fn take_while_inclusive<F>(self, accept: F) -> TakeWhileInclusive<Self, F> ⓘ
true
, including the element for which the predicate
first returned false
. Read moresource§fn while_some<A>(self) -> WhileSome<Self> ⓘ
fn while_some<A>(self) -> WhileSome<Self> ⓘ
Option<A>
iterator elements
and produces A
. Stops on the first None
encountered. Read moresource§fn tuple_combinations<T>(self) -> TupleCombinations<Self, T> ⓘ
fn tuple_combinations<T>(self) -> TupleCombinations<Self, T> ⓘ
source§fn combinations(self, k: usize) -> Combinations<Self> ⓘ
fn combinations(self, k: usize) -> Combinations<Self> ⓘ
k
-length combinations of
the elements from an iterator. Read moresource§fn combinations_with_replacement(
self,
k: usize,
) -> CombinationsWithReplacement<Self> ⓘ
fn combinations_with_replacement( self, k: usize, ) -> CombinationsWithReplacement<Self> ⓘ
k
-length combinations of
the elements from an iterator, with replacement. Read moresource§fn permutations(self, k: usize) -> Permutations<Self> ⓘ
fn permutations(self, k: usize) -> Permutations<Self> ⓘ
source§fn powerset(self) -> Powerset<Self> ⓘ
fn powerset(self) -> Powerset<Self> ⓘ
source§fn pad_using<F>(self, min: usize, f: F) -> PadUsing<Self, F> ⓘ
fn pad_using<F>(self, min: usize, f: F) -> PadUsing<Self, F> ⓘ
min
by filling missing elements using a closure f
. Read moresource§fn with_position(self) -> WithPosition<Self> ⓘwhere
Self: Sized,
fn with_position(self) -> WithPosition<Self> ⓘwhere
Self: Sized,
Position
to
ease special-case handling of the first or last elements. Read moresource§fn positions<P>(self, predicate: P) -> Positions<Self, P> ⓘ
fn positions<P>(self, predicate: P) -> Positions<Self, P> ⓘ
source§fn update<F>(self, updater: F) -> Update<Self, F> ⓘ
fn update<F>(self, updater: F) -> Update<Self, F> ⓘ
source§fn next_tuple<T>(&mut self) -> Option<T>
fn next_tuple<T>(&mut self) -> Option<T>
source§fn collect_tuple<T>(self) -> Option<T>
fn collect_tuple<T>(self) -> Option<T>
source§fn find_position<P>(&mut self, pred: P) -> Option<(usize, Self::Item)>
fn find_position<P>(&mut self, pred: P) -> Option<(usize, Self::Item)>
source§fn find_or_last<P>(self, predicate: P) -> Option<Self::Item>
fn find_or_last<P>(self, predicate: P) -> Option<Self::Item>
source§fn find_or_first<P>(self, predicate: P) -> Option<Self::Item>
fn find_or_first<P>(self, predicate: P) -> Option<Self::Item>
source§fn contains<Q>(&mut self, query: &Q) -> bool
fn contains<Q>(&mut self, query: &Q) -> bool
true
if the given item is present in this iterator. Read moresource§fn all_equal_value(
&mut self,
) -> Result<Self::Item, Option<(Self::Item, Self::Item)>>
fn all_equal_value( &mut self, ) -> Result<Self::Item, Option<(Self::Item, Self::Item)>>
source§fn all_unique(&mut self) -> bool
fn all_unique(&mut self) -> bool
source§fn dropping(self, n: usize) -> Selfwhere
Self: Sized,
fn dropping(self, n: usize) -> Selfwhere
Self: Sized,
n
elements from the iterator eagerly,
and return the same iterator again. Read moresource§fn dropping_back(self, n: usize) -> Selfwhere
Self: Sized + DoubleEndedIterator,
fn dropping_back(self, n: usize) -> Selfwhere
Self: Sized + DoubleEndedIterator,
n
elements from the iterator eagerly,
and return the same iterator again. Read moresource§fn concat(self) -> Self::Itemwhere
Self: Sized,
Self::Item: Extend<<<Self as Iterator>::Item as IntoIterator>::Item> + IntoIterator + Default,
fn concat(self) -> Self::Itemwhere
Self: Sized,
Self::Item: Extend<<<Self as Iterator>::Item as IntoIterator>::Item> + IntoIterator + Default,
source§fn collect_vec(self) -> Vec<Self::Item>where
Self: Sized,
fn collect_vec(self) -> Vec<Self::Item>where
Self: Sized,
.collect_vec()
is simply a type specialization of Iterator::collect
,
for convenience.source§fn try_collect<T, U, E>(self) -> Result<U, E>
fn try_collect<T, U, E>(self) -> Result<U, E>
source§fn set_from<'a, A: 'a, J>(&mut self, from: J) -> usize
fn set_from<'a, A: 'a, J>(&mut self, from: J) -> usize
self
from the from
iterator,
stopping at the shortest of the two iterators. Read moresource§fn format(self, sep: &str) -> Format<'_, Self>where
Self: Sized,
fn format(self, sep: &str) -> Format<'_, Self>where
Self: Sized,
sep
. Read moresource§fn format_with<F>(self, sep: &str, format: F) -> FormatWith<'_, Self, F>
fn format_with<F>(self, sep: &str, format: F) -> FormatWith<'_, Self, F>
sep
. Read moresource§fn fold_ok<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
fn fold_ok<A, E, B, F>(&mut self, start: B, f: F) -> Result<B, E>
Result
values from an iterator. Read moresource§fn fold_options<A, B, F>(&mut self, start: B, f: F) -> Option<B>
fn fold_options<A, B, F>(&mut self, start: B, f: F) -> Option<B>
Option
values from an iterator. Read moresource§fn fold1<F>(self, f: F) -> Option<Self::Item>
fn fold1<F>(self, f: F) -> Option<Self::Item>
Iterator::reduce
insteadsource§fn tree_reduce<F>(self, f: F) -> Option<Self::Item>
fn tree_reduce<F>(self, f: F) -> Option<Self::Item>
source§fn tree_fold1<F>(self, f: F) -> Option<Self::Item>
fn tree_fold1<F>(self, f: F) -> Option<Self::Item>
.tree_reduce()
.source§fn fold_while<B, F>(&mut self, init: B, f: F) -> FoldWhile<B>
fn fold_while<B, F>(&mut self, init: B, f: F) -> FoldWhile<B>
source§fn sum1<S>(self) -> Option<S>
fn sum1<S>(self) -> Option<S>
source§fn product1<P>(self) -> Option<P>
fn product1<P>(self) -> Option<P>
source§fn sorted_unstable(self) -> IntoIter<Self::Item> ⓘ
fn sorted_unstable(self) -> IntoIter<Self::Item> ⓘ
source§fn sorted_unstable_by<F>(self, cmp: F) -> IntoIter<Self::Item> ⓘ
fn sorted_unstable_by<F>(self, cmp: F) -> IntoIter<Self::Item> ⓘ
source§fn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
fn sorted_unstable_by_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
source§fn sorted(self) -> IntoIter<Self::Item> ⓘ
fn sorted(self) -> IntoIter<Self::Item> ⓘ
source§fn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item> ⓘ
fn sorted_by<F>(self, cmp: F) -> IntoIter<Self::Item> ⓘ
source§fn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
fn sorted_by_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
source§fn sorted_by_cached_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
fn sorted_by_cached_key<K, F>(self, f: F) -> IntoIter<Self::Item> ⓘ
source§fn k_smallest(self, k: usize) -> IntoIter<Self::Item> ⓘ
fn k_smallest(self, k: usize) -> IntoIter<Self::Item> ⓘ
source§fn k_smallest_by<F>(self, k: usize, cmp: F) -> IntoIter<Self::Item> ⓘ
fn k_smallest_by<F>(self, k: usize, cmp: F) -> IntoIter<Self::Item> ⓘ
source§fn k_smallest_by_key<F, K>(self, k: usize, key: F) -> IntoIter<Self::Item> ⓘ
fn k_smallest_by_key<F, K>(self, k: usize, key: F) -> IntoIter<Self::Item> ⓘ
source§fn k_largest(self, k: usize) -> IntoIter<Self::Item> ⓘ
fn k_largest(self, k: usize) -> IntoIter<Self::Item> ⓘ
source§fn k_largest_by<F>(self, k: usize, cmp: F) -> IntoIter<Self::Item> ⓘ
fn k_largest_by<F>(self, k: usize, cmp: F) -> IntoIter<Self::Item> ⓘ
source§fn k_largest_by_key<F, K>(self, k: usize, key: F) -> IntoIter<Self::Item> ⓘ
fn k_largest_by_key<F, K>(self, k: usize, key: F) -> IntoIter<Self::Item> ⓘ
source§fn tail(self, n: usize) -> IntoIter<Self::Item> ⓘwhere
Self: Sized,
fn tail(self, n: usize) -> IntoIter<Self::Item> ⓘwhere
Self: Sized,
n
elements. Read moresource§fn partition_map<A, B, F, L, R>(self, predicate: F) -> (A, B)
fn partition_map<A, B, F, L, R>(self, predicate: F) -> (A, B)
Iterator::partition
, each partition may
have a distinct type. Read moresource§fn partition_result<A, B, T, E>(self) -> (A, B)
fn partition_result<A, B, T, E>(self) -> (A, B)
Result
s into one list of all the Ok
elements
and another list of all the Err
elements. Read moresource§fn into_group_map<K, V>(self) -> HashMap<K, Vec<V>>
fn into_group_map<K, V>(self) -> HashMap<K, Vec<V>>
HashMap
of keys mapped to Vec
s of values. Keys and values
are taken from (Key, Value)
tuple pairs yielded by the input iterator. Read moresource§fn into_group_map_by<K, V, F>(self, f: F) -> HashMap<K, Vec<V>>
fn into_group_map_by<K, V, F>(self, f: F) -> HashMap<K, Vec<V>>
Iterator
on a HashMap
. Keys mapped to Vec
s of values. The key is specified
in the closure. Read moresource§fn into_grouping_map<K, V>(self) -> GroupingMap<Self>
fn into_grouping_map<K, V>(self) -> GroupingMap<Self>
GroupingMap
to be used later with one of the efficient
group-and-fold operations it allows to perform. Read moresource§fn into_grouping_map_by<K, V, F>(self, key_mapper: F) -> GroupingMapBy<Self, F>
fn into_grouping_map_by<K, V, F>(self, key_mapper: F) -> GroupingMapBy<Self, F>
GroupingMap
to be used later with one of the efficient
group-and-fold operations it allows to perform. Read moresource§fn min_set_by<F>(self, compare: F) -> Vec<Self::Item>
fn min_set_by<F>(self, compare: F) -> Vec<Self::Item>
source§fn min_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
fn min_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
source§fn max_set_by<F>(self, compare: F) -> Vec<Self::Item>
fn max_set_by<F>(self, compare: F) -> Vec<Self::Item>
source§fn max_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
fn max_set_by_key<K, F>(self, key: F) -> Vec<Self::Item>
source§fn minmax(self) -> MinMaxResult<Self::Item>
fn minmax(self) -> MinMaxResult<Self::Item>
source§fn minmax_by_key<K, F>(self, key: F) -> MinMaxResult<Self::Item>
fn minmax_by_key<K, F>(self, key: F) -> MinMaxResult<Self::Item>
source§fn minmax_by<F>(self, compare: F) -> MinMaxResult<Self::Item>
fn minmax_by<F>(self, compare: F) -> MinMaxResult<Self::Item>
source§fn position_max(self) -> Option<usize>
fn position_max(self) -> Option<usize>
source§fn position_max_by_key<K, F>(self, key: F) -> Option<usize>
fn position_max_by_key<K, F>(self, key: F) -> Option<usize>
source§fn position_max_by<F>(self, compare: F) -> Option<usize>
fn position_max_by<F>(self, compare: F) -> Option<usize>
source§fn position_min(self) -> Option<usize>
fn position_min(self) -> Option<usize>
source§fn position_min_by_key<K, F>(self, key: F) -> Option<usize>
fn position_min_by_key<K, F>(self, key: F) -> Option<usize>
source§fn position_min_by<F>(self, compare: F) -> Option<usize>
fn position_min_by<F>(self, compare: F) -> Option<usize>
source§fn position_minmax(self) -> MinMaxResult<usize>
fn position_minmax(self) -> MinMaxResult<usize>
source§fn position_minmax_by_key<K, F>(self, key: F) -> MinMaxResult<usize>
fn position_minmax_by_key<K, F>(self, key: F) -> MinMaxResult<usize>
source§fn position_minmax_by<F>(self, compare: F) -> MinMaxResult<usize>
fn position_minmax_by<F>(self, compare: F) -> MinMaxResult<usize>
source§fn exactly_one(self) -> Result<Self::Item, ExactlyOneError<Self>>where
Self: Sized,
fn exactly_one(self) -> Result<Self::Item, ExactlyOneError<Self>>where
Self: Sized,
source§fn at_most_one(self) -> Result<Option<Self::Item>, ExactlyOneError<Self>>where
Self: Sized,
fn at_most_one(self) -> Result<Option<Self::Item>, ExactlyOneError<Self>>where
Self: Sized,
Ok(None)
will be returned. If the iterator yields
exactly one element, that element will be returned, otherwise an error will be returned
containing an iterator that has the same output as the input iterator. Read moresource§fn multipeek(self) -> MultiPeek<Self> ⓘwhere
Self: Sized,
fn multipeek(self) -> MultiPeek<Self> ⓘwhere
Self: Sized,
.next()
values without advancing the base iterator. Read moresource§fn counts(self) -> HashMap<Self::Item, usize>
fn counts(self) -> HashMap<Self::Item, usize>
HashMap
which
contains each item that appears in the iterator and the number
of times it appears. Read moresource§fn counts_by<K, F>(self, f: F) -> HashMap<K, usize>
fn counts_by<K, F>(self, f: F) -> HashMap<K, usize>
HashMap
which
contains each item that appears in the iterator and the number
of times it appears,
determining identity using a keying function. Read more