binrw icon indicating copy to clipboard operation
binrw copied to clipboard

Add top-level `args` attribute for use with top-level map/try_map

Open jam1garner opened this issue 2 years ago • 0 comments

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 {
  // ...
}

jam1garner avatar Sep 03 '21 05:09 jam1garner