pub fn parse_vector<'input, O, P>(
    parser: P,
) -> impl Fn(&'input [u8]) -> IResult<&'input [u8], Vec<O>>
where
    P: Copy + Parser<&'input [u8], O, nom::error::Error<&'input [u8]>>,
{
    move |input| {
        let (input, length) = parse_u32(input)?;
        let length = length as usize;
        let (remaining, items) = fold_many_m_n(
            length,
            length,
            parser,
            move || Vec::with_capacity(length),
            |mut accumulator, item| {
                accumulator.push(item);
                accumulator
            },
        )(input)?;

        Ok((remaining, items))
    }
}
/// Parses a WebAssembly encoded vector of items from the input.
///
/// See <https://webassembly.github.io/spec/core/binary/conventions.html#vectors>
Parses a WebAssembly encoded vector of items from the input.
See
Parses a WebAssembly encoded vector of items from the input . See
pub fn parse_vector<'input, O, P>(
    parser: P,
) -> impl Fn(&'input [u8]) -> IResult<&'input [u8], Vec<O>>
where
    P: Copy + Parser<&'input [u8], O, nom::error::Error<&'input [u8]>>,
{
    move |input| {
        let (input, length) = parse_u32(input)?;
        let length = length as usize;
        let (remaining, items) = fold_many_m_n(
            length,
            length,
            parser,
            move || Vec::with_capacity(length),
            |mut accumulator, item| {
                accumulator.push(item);
                accumulator
            },
        )(input)?;
        Ok((remaining, items))
    }
}
pub fn parse_vector < ' input , O , P > ( parser : P , ) -> impl Fn ( & ' input [ u8 ] ) -> IResult < & ' input [ u8 ] , Vec < O > > where P : Copy + Parser < & ' input [ u8 ] , O , nom :: error :: Error < & ' input [ u8 ] > > , { move | input | { let ( input , length ) = parse_u32 ( input ) ? ; let length = length as usize ; let ( remaining , items ) = fold_many_m_n ( length , length , parser , move | | Vec :: with_capacity ( length ) , | mut accumulator , item | { accumulator . push ( item ) ; accumulator } , ) ( input ) ? ; Ok ( ( remaining , items ) ) } }
Parses a WebAssembly encoded vector of items from the input.
Parses a WebAssembly encoded vector of items from the input .
parser
P
parser
P