pub trait PackedItem:
IntoBytes
+ Immutable
+ Unaligned {
// Required method
unsafe fn from_bytes(bytes: &[u8]) -> &Self;
}Expand description
A trait for types that can be packed into a single contiguous buffer of bytes.
Required Methods§
Sourceunsafe fn from_bytes(bytes: &[u8]) -> &Self
unsafe fn from_bytes(bytes: &[u8]) -> &Self
Reconstructs the item from a byte slice.
§Safety
The caller must guarantee that the slice contains data that is byte-identical
to a slice returned by IntoBytes::as_bytes for a valid instance of this type.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".