To convert types to and from bytes, we use the [zerocopy
][zerocopy] library to do this safely.
It primarily works through three core marker traits, which are implemented for primitive types
and can be implemented for your own types with #[derive()]
.
They indicate what operations can be done on a type:
FromBytes
indicates that a type may safely be converted from an arbitrary byte sequence. This means that every possible byte pattern is valid for that type - as such, this cannot be implemented for mostenum
s.AsBytes
indicates that a type may safely be converted to a byte sequence.