Closed CraftSpider closed 2 years ago
This is actually supported already, but this support was not documented. If you specify attributes on your struct, they will be applied to the underlying struct definition. This includes the #[repr(C)]
attribute.
Commit ae73d7fef973877ce60d1f4035f43a29d581d9ca adds a test and updates the documentation that this is supported.
Currently, it's noted that fixed-length fields in a
define_varlen
will always be laid out 'as the Rust compiler decides'. It would be nice if the crate could supportrepr(C)
or similar, to allow defining structs that have a portable layout, or even are explicitly compatible with C variable-size end arrays.Note: If
#[repr(C)]
on a struct works as-is, it would at least be nice to have documentation of this fact.