[−][src]Crate zerocopy
Utilities for safe zero-copy parsing and serialization.
This crate provides utilities which make it easy to perform zero-copy parsing and serialization by allowing zero-copy conversion to/from byte slices.
This is enabled by three core marker traits:
FromBytes
indicates that a type may safely be converted from an arbitrary byte sequenceAsBytes
indicates that a type may safely be converted to a byte sequenceUnaligned
indicates that a type's alignment requirement is 1
Types which implement a subset of these traits can then be converted to/from byte sequences with little to no runtime overhead.
Structs
LayoutVerified | A length- and alignment-checked reference to a byte slice which can safely be reinterpreted as another type. |
Traits
AsBytes | Types which are safe to treat as an immutable byte slice. |
ByteSlice | A mutable or immutable reference to a byte slice. |
ByteSliceMut | A mutable reference to a byte slice. |
FromBytes | Types for which any byte pattern is valid. |
Unaligned | Types with no alignment requirement. |