[−][src]Trait nom::InputIter
abstracts common iteration operations on the input type
it needs a distinction between Item
and RawItem
because
&[T]
iterates on references
Associated Types
type Item
type RawItem
type Iter: Iterator<Item = (usize, Self::Item)>
type IterElem: Iterator<Item = Self::Item>
Required Methods
fn iter_indices(&self) -> Self::Iter
returns an iterator over the elements and their byte offsets
fn iter_elements(&self) -> Self::IterElem
returns an iterator over the elements
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::RawItem) -> bool,
P: Fn(Self::RawItem) -> bool,
finds the byte position of the element
fn slice_index(&self, count: usize) -> Option<usize>
get the byte offset from the element's position in the stream
Implementations on Foreign Types
impl<'a> InputIter for &'a [u8]
[src]
impl<'a> InputIter for &'a [u8]
type Item = u8
type RawItem = 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_indices(&self) -> Self::Iter
fn iter_elements(&self) -> Self::IterElem
[src]
fn iter_elements(&self) -> Self::IterElem
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool,
[src]
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool,
fn slice_index(&self, count: usize) -> Option<usize>
[src]
fn slice_index(&self, count: usize) -> Option<usize>
impl<'a> InputIter for &'a str
[src]
impl<'a> InputIter for &'a str
type Item = char
type RawItem = char
type Iter = CharIndices<'a>
type IterElem = Chars<'a>
fn iter_indices(&self) -> Self::Iter
[src]
fn iter_indices(&self) -> Self::Iter
fn iter_elements(&self) -> Self::IterElem
[src]
fn iter_elements(&self) -> Self::IterElem
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::RawItem) -> bool,
[src]
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::RawItem) -> bool,
fn slice_index(&self, count: usize) -> Option<usize>
[src]
fn slice_index(&self, count: usize) -> Option<usize>
Implementors
impl<'a> InputIter for CompleteByteSlice<'a>
[src]
impl<'a> InputIter for CompleteByteSlice<'a>
type Item = u8
type RawItem = 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_indices(&self) -> Self::Iter
fn iter_elements(&self) -> Self::IterElem
[src]
fn iter_elements(&self) -> Self::IterElem
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::RawItem) -> bool,
[src]
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::RawItem) -> bool,
fn slice_index(&self, count: usize) -> Option<usize>
[src]
fn slice_index(&self, count: usize) -> Option<usize>
impl<'a> InputIter for CompleteStr<'a>
[src]
impl<'a> InputIter for CompleteStr<'a>
type Item = char
type RawItem = char
type Iter = CharIndices<'a>
type IterElem = Chars<'a>
fn iter_indices(&self) -> Self::Iter
[src]
fn iter_indices(&self) -> Self::Iter
fn iter_elements(&self) -> Self::IterElem
[src]
fn iter_elements(&self) -> Self::IterElem
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::RawItem) -> bool,
[src]
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::RawItem) -> bool,
fn slice_index(&self, count: usize) -> Option<usize>
[src]
fn slice_index(&self, count: usize) -> Option<usize>
impl<T: InputIter> InputIter for Input<T>
[src]
impl<T: InputIter> InputIter for Input<T>
type Item = <T as InputIter>::Item
type RawItem = <T as InputIter>::RawItem
type Iter = <T as InputIter>::Iter
type IterElem = <T as InputIter>::IterElem
fn iter_indices(&self) -> Self::Iter
[src]
fn iter_indices(&self) -> Self::Iter
fn iter_elements(&self) -> Self::IterElem
[src]
fn iter_elements(&self) -> Self::IterElem
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::RawItem) -> bool,
[src]
fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::RawItem) -> bool,
fn slice_index(&self, count: usize) -> Option<usize>
[src]
fn slice_index(&self, count: usize) -> Option<usize>