jam1garner / jam1garner/binrw

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

Open
#39 0 comments 0 reactions 0 assignees View on GitHub
enhancement
Dominant language
Rust
Stars
853
Forks
56
PR merge metrics
No merged PRs in 30d

Description

In order to pass arguments to the input being passed to a top-level map function this is necessary.

```rust
#[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 {
// ...
}
```

Contributor guide

Open the contributing guide

Research direction

Start by tracing the top-level map/try_map handling and the derive_binread import and args syntax shown in the issue. Determine how the top-level args are passed to the mapped input, then add coverage for the example using b; done means the example compiles and the argument reaches SomeOtherStruct.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
devtools
Issue type
Feature
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
42/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.