Trait itertools_wild::ItertoolsWild
[−]
[src]
pub trait ItertoolsWild: Iterator { fn assert_exact_size(self, size: usize) -> AssertExactSize<Self>
where
Self: Sized, { ... } fn clamp_to_exact_length<F>(
self,
length: usize,
filler: F
) -> ClampToExactLength<Self, F>
where
Self: Sized,
F: FnMut(usize) -> Self::Item, { ... } }
Provided Methods
fn assert_exact_size(self, size: usize) -> AssertExactSize<Self> where
Self: Sized,
Self: Sized,
Assert that the iterator has an exact size hint; the result
is an iterator that produces the same sequence as usual but also
implements ExactSizeIterator
Note that this is not anything like unsafe
, since it's not related
to memory safety -- only logical consistency.
The AssertExactSize
adaptor will use debug assertions to check
the iterator's actual length.
fn clamp_to_exact_length<F>(
self,
length: usize,
filler: F
) -> ClampToExactLength<Self, F> where
Self: Sized,
F: FnMut(usize) -> Self::Item,
self,
length: usize,
filler: F
) -> ClampToExactLength<Self, F> where
Self: Sized,
F: FnMut(usize) -> Self::Item,
Clamp an iterator to an exact length
The adapted iterator never produces more than the length
amount
of elements. If the underlying iterator would end short of that,
the closure filler
is called to supply elements up until the
specific length
.
This iterator can be trusted to have the exact length, and it is fused.
Implementors
impl<I> ItertoolsWild for I where
I: Iterator,