Limited

Trait Limited 

Source
pub trait Limited: Iterator + Sized {
    type ContdIter: Iterator<Item = Self::Item>;

    // Required methods
    fn limited(self, length: usize) -> LimitedIter<Self> ;
    fn contd() -> Self::ContdIter;
}
Expand description

a trait for “limiting” an iterator.

this is used to wrap an iterator,

Required Associated Types§

Source

type ContdIter: Iterator<Item = Self::Item>

the type of iterator returned by Limited::contd().

Required Methods§

Source

fn limited(self, length: usize) -> LimitedIter<Self>

returns a “limited” iterator.

this will return at most size elements. once space is running out, the contents of the iterator returned by Limited::contd() will be used to indicate that the value is being “limited”, or truncated.

e.g. for strings, represented as an iterator of characters, one might use "...".

Source

fn contd() -> Self::ContdIter

returns an iterator of values to use as an indication of truncation.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<I> Limited for I
where I: Iterator<Item = char> + Sized,

character iterators can be limited with elipses.

Source§

type ContdIter = Chars<'static>