[−][src]Macro nom::many1_count
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::digit; named!(number<&[u8], usize>, many1_count!(pair!(digit, tag!(",")))); fn main() { assert_eq!(number(&b"123,45,abc"[..]), Ok((&b"abc"[..], 2))); }