Function binread::helpers::count [−][src]
pub fn count<R, T, Arg, Ret>(
n: usize
) -> impl Fn(&mut R, &ReadOptions, Arg) -> BinResult<Ret> where
T: BinRead<Args = Arg>,
R: Read + Seek,
Arg: Clone,
Ret: FromIterator<T>,
Expand description
A helper equivelant to #[br(count = N)]
which can be used with any collection.
Examples
#[derive(BinRead)]
struct CountBytes {
len: u8,
#[br(parse_with = count(len as usize))]
data: Vec<u8>,
}