-
Notifications
You must be signed in to change notification settings - Fork 47
Closed
Description
Notice the following line in the example from #217:
#[br(map_stream = |s| s.take_seek(16), parse_with = |r, e, _:()| until_eof(r, e, (v,)))]I expect there to be a simpler way to achieve this:
#[br(map_stream = |s| s.take_seek(16), parse_with = until_eof, args(v))]Surprisingly, this fails to compile:
error[E0308]: mismatched types
--> src/test.rs:46:9
|
461 | #[derive(Debug, BinRead)]
| ------- this type parameter
...
467 | #[br(map_stream = |s| s.take_seek(16), parse_with = helpers::until_eof, args(v))]
| ------- arguments to this function are incorrect
468 | data: Vec<Thing>,
| ^^^^ expected `&mut R`, found `&mut TakeSeek<&mut R>`
|
= note: expected mutable reference `&mut R`
found mutable reference `&mut TakeSeek<&mut R>`
note: function defined here
--> /home/nofitserov/.cargo/registry/src/index.crates.io-6f17d22bba15001f/binrw-0.13.1/src/helpers.rs:213:8
|
213 | pub fn until_eof<Reader, T, Arg, Ret>(
| ^^^^^^^^^
It seems that currently parse_function_args_type_hint unconditionally asserts/requires that the first argument to the parse function is of type &mut R, regardless of map_stream presence.
Metadata
Metadata
Assignees
Labels
No labels