Function binrw::helpers::until_exclusive
source · pub fn until_exclusive<Reader, T, CondFn, Arg, Ret>(
cond: CondFn,
) -> impl Fn(&mut Reader, Endian, Arg) -> BinResult<Ret>
Expand description
Creates a parser that reads items into a collection until a condition is met. The terminal item is discarded.
This helper can be used to read into any collection type that implements
FromIterator
.
§Examples
#[derive(BinRead)]
struct NullTerminated {
#[br(parse_with = until_exclusive(|&byte| byte == 0))]
data: Vec<u8>,
}