Pad a vector's items
- Dominant language
- Rust
- Stars
- 853
- Forks
- 56
- PR merge metrics
- No merged PRs in 30d
Description
```rust
#[derive(BinRead)]
#[br(little)]
// Is 7+ bytes but needs to get padded to `arbitrary`
pub struct Bar {
f1: u8,
f2: u16,
len: u32,
#[br(count = len)]
v: Vec
}
#[derive(BinRead)]
pub struct Foo {
arbitrary: u8,
len: u8,
#[br(pad_size_to = arbitrary, count = len)]
pub list: Vec
}
// passing [
// 12, 2,
// 1, 2, 0, // f1, f2
// 1, 0, 0, 0, // len
// 42, // list
// 0, 0, 0, 0, // padding
// 4, 5, 0, // f1, f2
// 2, 0, 0, 0, // len
// 41, 43 // list
// 0, 0, 0 // padding
// ]
// should return Foo { arbitrary: 8, len: 2, list: vec![Bar {f1: 1, f2: 2, len: 1, list: vec![42]}] }
```
This doesn't currently work
Contributor guide
Research direction
No file or test is named in the issue. Start by reproducing the supplied Rust BinRead example in the repository's existing test setup, then trace the vector padding behavior; done means the example parses into the expected Foo and nested Bar values, including the padding bytes.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 4/5
- Estimated time
- 3-5 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 30/100