Skip to content

Commit

Permalink
Use try_calc in docs index example
Browse files Browse the repository at this point in the history
  • Loading branch information
csnover committed Nov 26, 2022
1 parent bf32875 commit ed89b93
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions binrw/doc/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -150,9 +150,10 @@ using the `#[br]`, `#[bw]`, and `#[brw]` attributes:
```
# use binrw::{prelude::*, io::Cursor, NullString};
#
#[derive(BinRead)]
#[br(big, magic = b"DOG", assert(name.len() != 0))]
#[binrw]
#[brw(big, magic = b"DOG", assert(name.len() != 0))]
struct Dog {
#[bw(try_calc(u8::try_from(bone_piles.len())))]
bone_pile_count: u8,
#[br(count = bone_pile_count)]
Expand Down

0 comments on commit ed89b93

Please sign in to comment.