Closed NTmatter closed 1 year ago
Sorry I didn't give this a good look-over when I gave it a bug label.
There isn't really good compiler errors for this, but Contained
needs to understand that it's endian will always come from a ctx
from the endian
attribute use. These docs might give you some extra context for this. Thus, the following works:
use deku::prelude::*;
use deku::ctx::Endian;
#[derive(Debug, DekuRead, DekuWrite)]
#[deku(endian = "endian", ctx = "endian: Endian")]
struct Contained {
a: u32,
b: u32,
}
#[derive(Debug, DekuRead, DekuWrite)]
#[deku(endian = "big")]
struct DekuFail {
a: u32,
b: u32,
foo: [Contained; 8],
}
Closing, let me know if you still have issues.
Specifying endianness with
#[deku(endian = "big")]
will fail to compile when a structure contains something other than a primitive or primitive array.This can be worked around by specifying endianness on the primitive fields, though it feels rather noisy and unergonomic to do so.