binrw
binrw copied to clipboard
Add top-level `args` attribute for use with top-level map/try_map
In order to pass arguments to the input being passed to a top-level map function this is necessary.
#[derive_binread]
#[br(import { b: u64 })]
struct SomeOtherStruct {
// ...
}
#[derive_binread]
#[br(import { a: u32, b: u64 })]
#[br(args { b })]
#[br(map = |x: SomeOtherStruct| SomeStruct {/* ... */} )]
struct SomeStruct {
// ...
}