Function binrw::until_eof

source ·
pub fn until_eof<Reader, T, Arg, Ret>(
    reader: &mut Reader,
    endian: Endian,
    args: Arg
) -> BinResult<Ret>where
    T: for<'a> BinRead<Args<'a> = Arg>,
    Reader: Read + Seek,
    Arg: Clone,
    Ret: FromIterator<T>,
Expand description

Creates a parser that reads items into a collection until the end of the input stream.

This helper can be used to read into any collection type that implements FromIterator.

Errors

If reading fails for a reason other than reaching the end of the input, an Error variant will be returned.

Examples

#[derive(BinRead)]
struct EntireFile {
    #[br(parse_with = until_eof)]
    data: Vec<u8>,
}