Macro nom::many1_count [−][src]
many1_count!(I -> IResult<I,O>) => I -> IResult<I, usize>
Applies the parser 1 or more times and returns the number of times the parser was applied.
#[macro_use] extern crate nom; use nom::character::streaming::digit1; named!(number<&[u8], usize>, many1_count!(pair!(digit1, tag!(",")))); fn main() { assert_eq!(number(&b"123,45,abc"[..]), Ok((&b"abc"[..], 2))); }