macro_rules! impl_input_iter {
    ($fragment_type:ty, $item:ty, $raw_item:ty, $iter:ty, $iter_elem:ty) => { ... };
}
Expand description

Implement nom::InputIter for a specific fragment type

§Parameters

  • $fragment_type - The LocatedSpan’s fragment type
  • $item - The type of the item being iterated (a reference for fragments of type &[T]).
  • $raw_item - The raw type of the item being iterating (dereferenced type of $item for &[T], otherwise same as $item)
  • $iter - The iterator type for iter_indices()
  • $iter_elem - The iterator type for iter_elements()

§Example of use

NB: This example is an extract from the nom_locate source code.

#[macro_use]
extern crate nom_locate;

impl_input_iter!(&'a str, char, char, CharIndices<'a>, Chars<'a>);
impl_input_iter!(&'a [u8], &'a u8, u8, Enumerate<Iter<'a, Self::RawItem>>,
                 Iter<'a, Self::RawItem>);