Trait nom::InputIter [−][src]
pub trait InputIter { type Item; type Iter: Iterator<Item = (usize, Self::Item)>; type IterElem: Iterator<Item = Self::Item>; 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) -> Result<usize, Needed>; }
Abstracts common iteration operations on the input type
Associated Types
type Item
[src][−]
The current input type is a sequence of that Item
type.
Example: u8
for &[u8]
or char
for &str
type Iter: Iterator<Item = (usize, Self::Item)>
[src][−]
An iterator over the input type, producing the item and its position
for use with Slice. If we’re iterating over &str
, the position
corresponds to the byte index of the character
type IterElem: Iterator<Item = Self::Item>
[src][−]
An iterator over the input type, producing the item
Required methods
fn iter_indices(&self) -> Self::Iter
[src][−]
Returns an iterator over the elements and their byte offsets
fn iter_elements(&self) -> Self::IterElem
[src][−]
Returns an iterator over the elements
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool,
[src][−]
P: Fn(Self::Item) -> bool,
Finds the byte position of the element
fn slice_index(&self, count: usize) -> Result<usize, Needed>
[src][−]
Get the byte offset from the element’s position in the stream