FromBytes

Derive Macro FromBytes 

Source
#[derive(FromBytes)]
{
    // Attributes available to this derive:
    #[packbytes]
}
Expand description

Derive the FromBytes trait for structs where each field implements it.

Const generics in stable don’t allow implementing FromBytes for arrays [T; N] where T: FromBytes. This macro circumvents that by deriving a different implementation for fields whose types are arrays, allowing the trait to be derived even for structs with such fields.

§Endianness

By default, the FromBytes and ToBytes derive macros assume that the data is prefered to be stored in the little endian order. You can change this by setting the attribute #[packbytes(be)] for big endian or #[packbytes(ne)] for the platform native endian.