Try building a library with the following code:
use binrw::binread;
#[binread]
#[br(stream = reader)]
enum Foo {
Bar {
#[br(count = 1)]
vec: Vec<u8>,
},
}
I would expect this to compile, but it gives the following error:
error[E0382]: borrow of moved value
--> src\lib.rs:3:1
|
3 | #[binread]
| ^^^^^^^^^^
| |
| value moved due to this method call
| borrow occurs due to use in closure
| value borrowed here after move
| move occurs because value has type `&mut R`,which does not implement the `Copy` trait
|
note: `stream_position` takes ownership of the receiver `self`, which moves value
--> *omitted*/rust\library\std\src\io\mod.rs:2154:29
|
2154 | fn stream_position(&mut self) -> Resu...
| ^^^^
= note: this error originates in the attributemacro `binread` (in Nightly builds, run with -Z macro-backtrace for more info)
help: borrow this binding in the pattern to avoid moving the value
|
3 | ref #[binread]
| +++
For more information about this error, try `rustc --explain E0382`.
error: could not compile `binrw_test` (lib) due to 1 previous error
Try building a library with the following code:
I would expect this to compile, but it gives the following error: