-
-
Notifications
You must be signed in to change notification settings - Fork 75
Closed
byteit101/deku
#1Labels
documentationImprovements or additions to documentationImprovements or additions to documentation
Description
I was following the tutorial at https://docs.rs/deku/latest/deku/index.html and, after 2 successes, I merged the two examples together, getting a strange compilation error.
src/main.rs:
use deku::prelude::*;
#[derive(Debug, PartialEq, DekuRead, DekuWrite)]
#[deku(endian = "big")]
struct DekuTest {
#[deku(bits = 4)]
field_a: u8,
#[deku(bits = 4)]
field_b: u8,
field_c: DekuHeader,
}
#[derive(Debug, PartialEq, DekuRead, DekuWrite)]
struct DekuHeader(u8);
fn main() {
println!("Hello, world!");
}cargo.toml:
[package]
name = "test"
version = "0.1.0"
edition = "2021"
[dependencies]
deku = "0.19.1"Result:
error[E0308]: mismatched types
--> src/main.rs:3:28
|
3 | #[derive(Debug, PartialEq, DekuRead, DekuWrite)]
| ^^^^^^^^
| |
| expected `()`, found `Endian`
| arguments to this function are incorrect
|
note: associated function defined here
--> /cargo/registry/src/index.crates.io-6f17d22bba15001f/deku-0.19.1/src/lib.rs:423:8
|
423 | fn from_reader_with_ctx<R: no_std_io::Read + no_std_io::Seek>(
| ^^^^^^^^^^^^^^^^^^^^
= note: this error originates in the derive macro `DekuRead` (in Nightly builds, run with -Z macro-backtrace for more info)
error[E0308]: mismatched types
--> src/main.rs:3:38
|
3 | #[derive(Debug, PartialEq, DekuRead, DekuWrite)]
| ^^^^^^^^^
| |
| expected `()`, found `Endian`
| arguments to this function are incorrect
|
note: method defined here
--> /cargo/registry/src/index.crates.io-6f17d22bba15001f/deku-0.19.1/src/lib.rs:489:8
|
489 | fn to_writer<W: no_std_io::Write + no_std_io::Seek>(
| ^^^^^^^^^
= note: this error originates in the derive macro `DekuWrite` (in Nightly builds, run with -Z macro-backtrace for more info)
For more information about this error, try `rustc --explain E0308`.
error: could not compile `test` (bin "test") due to 2 previous errors
carlocorradini
Metadata
Metadata
Assignees
Labels
documentationImprovements or additions to documentationImprovements or additions to documentation