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

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.

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