Repository navigation
|
I have situation where I have (simplified) Where the sum bytes consumed for I would assume I can do this with something from the helpers, but I can not really figure out how. I would like something to the python equivalent |
Answered by
csnover
Apr 5, 2023
Replies: 1 comment 2 replies
|
You should be able to use the TakeSeek stream wrapper to limit the size of the stream plus the until_eof helper to read through the end of that data: use binrw::io::TakeSeekExt;
#[derive(BinRead, BinWrite, Debug, Clone)]
pub struct EDK2VariableStore {
pub size_in_bytes: u32,
#[br(align_after = 4, map_stream = |s| s.take_seek(size_in_bytes.into()), parse_with = binrw::helpers::until_eof)]
pub variables: Vec<VariableEntry>,
pub something_else :u32,
....
} |
2 replies
Answer selected by
Mimoja
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
You should be able to use the TakeSeek stream wrapper to limit the size of the stream plus the until_eof helper to read through the end of that data: