[−][src]Macro nom::many0
many0!(I -> IResult<I,O>) => I -> IResult<I, Vec<O>>
Applies the parser 0 or more times and returns the list of results in a Vec.
The embedded parser may return Incomplete.
many0
will only return Error
if the embedded parser does not consume any input
(to avoid infinite loops).
named!(multi<&[u8], Vec<&[u8]> >, many0!( tag!( "abcd" ) ) ); let a = b"abcdabcdefgh"; let b = b"azerty"; let res = vec![&b"abcd"[..], &b"abcd"[..]]; assert_eq!(multi(&a[..]),Ok((&b"efgh"[..], res))); assert_eq!(multi(&b[..]),Ok((&b"azerty"[..], Vec::new())));