Trait nom::InputIter [−][src]
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) -> Option<usize>
[src]
get the byte offset from the element’s position in the stream
Implementations on Foreign Types
impl<'a> InputIter for &'a [u8]
[src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Map<Iter<'a, Self::Item>, fn(_: &u8) -> u8>
fn iter_indices(&self) -> Self::Iter
[src]
fn iter_elements(&self) -> Self::IterElem
[src]
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool,
[src]
P: Fn(Self::Item) -> bool,
fn slice_index(&self, count: usize) -> Option<usize>
[src]
impl<'a> InputIter for &'a str
[src]
type Item = char
type Iter = CharIndices<'a>
type IterElem = Chars<'a>
fn iter_indices(&self) -> Self::Iter
[src]
fn iter_elements(&self) -> Self::IterElem
[src]
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool,
[src]
P: Fn(Self::Item) -> bool,