Trait nom::traits::InputIter

source ·
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) -> Result<usize, Needed>;
}
Expand description

Abstracts common iteration operations on the input type

Required Associated Types§

source

type Item

The current input type is a sequence of that Item type.

Example: u8 for &[u8] or char for &str

source

type Iter: Iterator<Item = (usize, Self::Item)>

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

source

type IterElem: Iterator<Item = Self::Item>

An iterator over the input type, producing the item

Required Methods§

source

fn iter_indices(&self) -> Self::Iter

Returns an iterator over the elements and their byte offsets

source

fn iter_elements(&self) -> Self::IterElem

Returns an iterator over the elements

source

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

Finds the byte position of the element

source

fn slice_index(&self, count: usize) -> Result<usize, Needed>

Get the byte offset from the element’s position in the stream

Object Safety§

This trait is not object safe.

Implementations on Foreign Types§

source§

impl<'a> InputIter for &'a str

source§

type Item = char

source§

type Iter = CharIndices<'a>

source§

type IterElem = Chars<'a>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 0]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 0] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 1]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 1] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 2]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 2] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 3]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 3] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 4]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 4] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 5]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 5] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 6]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 6] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 7]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 7] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 8]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 8] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 9]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 9] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 10]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 10] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 11]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 11] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 12]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 12] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 13]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 13] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 14]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 14] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 15]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 15] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 16]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 16] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 17]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 17] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 18]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 18] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 19]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 19] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 20]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 20] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 21]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 21] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 22]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 22] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 23]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 23] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 24]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 24] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 25]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 25] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 26]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 26] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 27]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 27] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 28]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 28] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 29]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 29] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 30]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 30] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 31]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 31] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8; 32]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8; 32] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

source§

impl<'a> InputIter for &'a [u8]

source§

type Item = u8

source§

type Iter = Enumerate<<&'a [u8] as InputIter>::IterElem>

source§

type IterElem = Copied<Iter<'a, u8>>

source§

fn iter_indices(&self) -> Self::Iter

source§

fn iter_elements(&self) -> Self::IterElem

source§

fn position<P>(&self, predicate: P) -> Option<usize>
where P: Fn(Self::Item) -> bool,

source§

fn slice_index(&self, count: usize) -> Result<usize, Needed>

Implementors§