[−][src]Trait nom::InputIter
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
pub fn iter_indices(&self) -> Self::Iter[src]
Returns an iterator over the elements and their byte offsets
pub fn iter_elements(&self) -> Self::IterElem[src]
Returns an iterator over the elements
pub 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
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[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 = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a str[src]
type Item = char
type Iter = CharIndices<'a>
type IterElem = Chars<'a>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a, O, T> InputIter for &'a BitSlice<O, T> where
O: BitOrder,
T: 'a + BitStore, [src]
O: BitOrder,
T: 'a + BitStore,
type Item = bool
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, O, T>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 0][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 1][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 2][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 3][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 4][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 5][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 6][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 7][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 8][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 9][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 10][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 11][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 12][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 13][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 14][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 15][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 16][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 17][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 18][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 19][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 20][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 21][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 22][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 23][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 24][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 25][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 26][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 27][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 28][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 29][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 30][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 31][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,
pub fn slice_index(&self, count: usize) -> Result<usize, Needed>[src]
impl<'a> InputIter for &'a [u8; 32][src]
type Item = u8
type Iter = Enumerate<Self::IterElem>
type IterElem = Copied<Iter<'a, u8>>
pub fn iter_indices(&self) -> Self::Iter[src]
pub fn iter_elements(&self) -> Self::IterElem[src]
pub fn position<P>(&self, predicate: P) -> Option<usize> where
P: Fn(Self::Item) -> bool, [src]
P: Fn(Self::Item) -> bool,