zerocopy

Derive Macro TryFromBytes

#[derive(TryFromBytes)]
Expand description

Implements TryFromBytes.

This derive synthesizes the runtime checks required to check whether a sequence of initialized bytes corresponds to a valid instance of a type. This derive can be applied to structs, enums, and unions; e.g.:

#[derive(TryFromBytes)]
struct MyStruct {
    ...
}

#[derive(TryFromBytes)]
#[repr(u8)]
enum MyEnum {
    ...
}

#[derive(TryFromBytes, Immutable)]
union MyUnion {
    ...
}