Macro gutenberg_post_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

#[macro_use] extern crate nom;
#[macro_use] extern crate gutenberg_post_parser;

named!(
    test<Vec<&[u8]>>,
    fold_into_vector_many0!(
        tag!("abc"),
        Vec::new()
    )
);

if let Ok((_, vector)) = test(b"abcabcabc") {
    assert_eq!(vector.capacity(), vector.len());
}