Macro tagua_parser::fold_into_vector_many0
[−]
[src]
macro_rules! fold_into_vector_many0 { ($input:expr, $submacro:ident!($($arguments:tt)*), $init:expr) => { ... }; ($input:expr, $function:expr, $init:expr) => { ... }; }
fold_into_vector_many0!(I -> IResult<I,O>, R) => I -> IResult<I, R>
is a wrapper around fold_many0!
specifically designed for vectors.
This is strictly equivalent to fold_many0!(submacro!(…), Vec::new(), fold_into_vector)
but it shrinks the capacity of the
vector to fit the current length.
Examples
use tagua_parser::Result; named!( test< Vec<&[u8]> >, fold_into_vector_many0!( tag!("abc"), Vec::new() ) ); if let Result::Done(_, vector) = test(&b"abcabcabc"[..]) { assert_eq!(vector.capacity(), vector.len()); }Run