pub fn read_vec_cb<R: ::std::io::Read, T, F>(reader: &mut R, cb: &F) -> Result<Vec<T>, DecodeError>
where
    F: Fn(&mut R) -> Result<T, DecodeError>,
{
    let len: BigSize = Readable::read(reader)?;
    if len.0 > MAX_VEC_SIZE {
        return Err(DecodeError::InvalidValue);
    }
    let mut res = Vec::<T>::new();
    for _ in 0..len.0 {
        res.push(cb(reader)?);
    }

    Ok(res)
}
/// Reads a vector of values from the given reader using the provided callback to
/// deserialize each value.
Reads a vector of values from the given reader using the provided callback to
deserialize each value.
Reads a vector of values from the given reader using the provided callback to deserialize each value .
pub fn read_vec_cb<R: ::std::io::Read, T, F>(reader: &mut R, cb: &F) -> Result<Vec<T>, DecodeError>
where
    F: Fn(&mut R) -> Result<T, DecodeError>,
{
    let len: BigSize = Readable::read(reader)?;
    if len.0 > MAX_VEC_SIZE {
        return Err(DecodeError::InvalidValue);
    }
    let mut res = Vec::<T>::new();
    for _ in 0..len.0 {
        res.push(cb(reader)?);
    }
    Ok(res)
}
pub fn read_vec_cb < R : :: std :: io :: Read , T , F > ( reader : & mut R , cb : & F ) -> Result < Vec < T > , DecodeError > where F : Fn ( & mut R ) -> Result < T , DecodeError > , { let len : BigSize = Readable :: read ( reader ) ? ; if len . 0 > MAX_VEC_SIZE { return Err ( DecodeError :: InvalidValue ) ; } let mut res = Vec :: < T > :: new ( ) ; for _ in 0 .. len . 0 { res . push ( cb ( reader ) ? ) ; } Ok ( res ) }
Reads a vector of values from the given reader using the provided callback to
deserialize each value.
Reads a vector of values from the given reader using the provided callback to deserialize each value .
reader
&mut R
cb
&F