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§
Sourcetype ContdIter: Iterator<Item = Self::Item>
type ContdIter: Iterator<Item = Self::Item>
the type of iterator returned by Limited::contd().
Required Methods§
Sourcefn limited(self, length: usize) -> LimitedIter<Self> ⓘ
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 "...".
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.