pub trait InputIter {
type Item;
type Iter: Iterator<Item = (usize, Self::Item)>;
type IterElem: Iterator<Item = Self::Item>;
// Required methods
fn iter_indices(&self) -> Self::Iter;
fn iter_elements(&self) -> Self::IterElem;
fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool;
fn slice_index(&self, count: usize) -> Option<usize>;
}
Expand description
abstracts common iteration operations on the input type
Required Associated Types§
sourcetype Item
type Item
the current input type is a sequence of that Item
type.
example: u8
for &[u8]
or char
for &str`
Required Methods§
sourcefn iter_indices(&self) -> Self::Iter
fn iter_indices(&self) -> Self::Iter
returns an iterator over the elements and their byte offsets
sourcefn iter_elements(&self) -> Self::IterElem
fn iter_elements(&self) -> Self::IterElem
returns an iterator over the elements
sourcefn slice_index(&self, count: usize) -> Option<usize>
fn slice_index(&self, count: usize) -> Option<usize>
get the byte offset from the element’s position in the stream
Object Safety§
This trait is not object safe.