Function binrw::file_ptr::parse_from_iter
source · pub fn parse_from_iter<Ptr, Value, Ret, Args, It, Reader>(
it: It,
) -> impl FnOnce(&mut Reader, Endian, Args) -> BinResult<Ret>where
Ptr: IntoSeekFrom,
Value: for<'a> BinRead<Args<'a> = Args>,
Ret: FromIterator<Value>,
Args: Clone,
It: IntoIterator<Item = Ptr>,
Reader: Read + Seek,
Expand description
Creates a parser that reads a collection of values from an iterator of
file offsets using the BinRead
implementation of Value
.
Offsets are treated as relative to the position of the reader when
parsing begins. Use the seek_before
directive to reposition the
stream in this case.
See the module documentation for more information on how
use parse_from_iter
.
§Examples
#[derive(BinRead)]
#[br(big)]
struct Header {
count: u16,
#[br(args { count: count.into() })]
offsets: Vec<u16>,
}
#[derive(BinRead)]
#[br(big)]
struct Object {
header: Header,
#[br(parse_with = binrw::file_ptr::parse_from_iter(header.offsets.iter().copied()))]
values: Vec<u8>,
}