binrw 0.15.1

A Rust crate for helping read structs from binary data using ✨macro magic✨
Documentation
error[E0277]: the trait bound `VecArgs<()>: MissingArgsDirective` is not satisfied
 --> tests/ui/args_vec_mistakes.rs:7:20
  |
7 | struct MissingArgs(Vec<u8>);
  |                    ^^^^^^^ the trait `Default` is not implemented for `VecArgs<()>`
  |
  = note: required for `VecArgs<()>` to implement `MissingArgsDirective`
note: required by a bound in `Required::args`
 --> src/private.rs
  |
  | pub trait Required: MissingArgsDirective {
  |                     ^^^^^^^^^^^^^^^^^^^^ required by this bound in `Required::args`
  |     fn args() -> Self;
  |        ---- required by a bound in this associated function

error[E0308]: mismatched types
  --> tests/ui/args_vec_mistakes.rs:10:23
   |
10 | struct WrongType(#[br(args((),))] Vec<u8>);
   |                       ^^^^        ------- expected due to this
   |                       |
   |                       expected `VecArgs<()>`, found `((),)`
   |
   = note: expected struct `VecArgs<()>`
               found tuple `((),)`

error[E0599]: the method `finalize` exists for struct `binrw::binread::impls::VecArgsBuilder<(), Needed, Satisfied>`, but its trait bounds were not satisfied
  --> tests/ui/args_vec_mistakes.rs:13:26
   |
13 | struct MissingCount(#[br(args { inner: () })] Vec<u8>);
   |                          ^^^^ method cannot be called due to unsatisfied trait bounds
   |
  ::: src/named_args.rs
   |
   | pub struct Needed;
   | ----------------- doesn't satisfy `Needed: SatisfiedOrOptional`
   |
   = note: the following trait bounds were not satisfied:
           `Needed: SatisfiedOrOptional`
   = note: this error originates in the macro `binrw::args` (in Nightly builds, run with -Z macro-backtrace for more info)

error[E0277]: the trait bound `usize: TryFrom<Option<{integer}>>` is not satisfied
  --> tests/ui/args_vec_mistakes.rs:22:36
   |
22 | struct WrongCountType(#[br(count = Some(1))] Vec<u8>);
   |                                    ^^^^^^^ the trait `From<Option<{integer}>>` is not implemented for `usize`
   |
   = help: the following other types implement trait `From<T>`:
             `usize` implements `From<bool>`
             `usize` implements `From<std::ptr::Alignment>`
             `usize` implements `From<u16>`
             `usize` implements `From<u8>`
   = note: required for `Option<{integer}>` to implement `Into<usize>`
   = note: required for `usize` to implement `TryFrom<Option<{integer}>>`

error[E0599]: the method `finalize` exists for struct `binrw::binread::impls::VecArgsBuilder<(NoDefault,), Satisfied, Needed>`, but its trait bounds were not satisfied
  --> tests/ui/args_vec_mistakes.rs:25:42
   |
 4 | struct NoDefault;
   | ---------------- doesn't satisfy `NoDefault: Default`
...
25 | struct MissingInnerArgs(#[br(count = 1)] Vec<Inner>);
   |                                          ^^^^^^^^^^ method cannot be called due to unsatisfied trait bounds
   |
  ::: src/named_args.rs
   |
   | pub struct Needed;
   | ----------------- doesn't satisfy `Needed: SatisfiedOrOptional`
   |
   = note: the following trait bounds were not satisfied:
           `NoDefault: Default`
           which is required by `(NoDefault,): Default`
           `Needed: SatisfiedOrOptional`
   = note: this error originates in the macro `binrw::args` (in Nightly builds, run with -Z macro-backtrace for more info)
help: consider annotating `NoDefault` with `#[derive(Default)]`
   |
 4 + #[derive(Default)]
 5 | struct NoDefault;
   |

error[E0277]: the trait bound `VecArgs<()>: Required` is not satisfied
  --> tests/ui/args_vec_mistakes.rs:28:5
   |
28 |     Vec::<u8>::read(&mut binrw::io::Cursor::new(b"")).unwrap();
   |     ^^^^^^^^^ the trait `Default` is not implemented for `VecArgs<()>`
   |
   = note: required for `VecArgs<()>` to implement `Required`
note: required by a bound in `binrw::BinRead::read`
  --> src/binread/mod.rs
   |
   |     fn read<R: Read + Seek>(reader: &mut R) -> BinResult<Self>
   |        ---- required by a bound in this associated function
...
   |         for<'a> Self::Args<'a>: Required,
   |                                 ^^^^^^^^ required by this bound in `BinRead::read`