Trait ItertoolsWild

Source
pub trait ItertoolsWild: Iterator {
    // Provided methods
    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§

Source

fn assert_exact_size(self, size: usize) -> AssertExactSize<Self>
where 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.

Source

fn clamp_to_exact_length<F>( 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§

Source§

impl<I> ItertoolsWild for I
where I: Iterator,