Function binread::until[][src]

pub fn until<Reader, T, CondFn, Arg, Ret>(
    cond: CondFn
) -> impl Fn(&mut Reader, &ReadOptions, Arg) -> BinResult<Ret> where
    T: BinRead<Args = Arg>,
    Reader: Read + Seek,
    CondFn: Fn(&T) -> bool,
    Arg: Clone,
    Ret: FromIterator<T>, 
Expand description

Read items until a condition is met. The final item will be included.

Examples

#[derive(BinRead)]
struct NullTerminated {
    #[br(parse_with = until(|&byte| byte == 0))]
    data: Vec<u8>,
}