[−][src]Macro nom::fold_many0
fold_many0!(I -> IResult<I,O>, R, Fn(R, O) -> R) => I -> IResult<I, R>
Applies the parser 0 or more times and folds the list of return values
the embedded parser may return Incomplete
named!(multi<&[u8], Vec<&[u8]> >, fold_many0!( tag!( "abcd" ), Vec::new(), |mut acc: Vec<_>, item| { acc.push(item); acc })); 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())));
0 or more