Byteable

Derive Macro Byteable 

Source
#[derive(Byteable)]
Expand description

Implements the Byteable trait for a struct.

This procedural macro automatically generates the necessary Byteable implementation for a given struct. It relies on std::mem::size_of to determine the ByteArray size and uses std::mem::transmute for efficient conversion, assuming a #[repr(C)] or #[repr(C, packed)] layout.

ยงPanics

This macro will trigger a compilation error if the input is not a struct, or if std::mem::size_of::<Self>() is not equal to std::mem::size_of::<Self::ByteArray>(), which can happen if the #[repr(C)] or #[repr(packed)] attributes are not correctly applied, or if there are padding bytes. Ensure the struct has a predictable layout.