Function bytemuck::try_pod_read_unaligned
source · pub fn try_pod_read_unaligned<T: AnyBitPattern>(
bytes: &[u8]
) -> Result<T, PodCastError>
Expand description
Reads from the bytes as if they were a T
.
Unlike from_bytes
, the slice doesn’t need to respect alignment of T
,
only sizes must match.
§Failure
- If the
bytes
length is not equal tosize_of::<T>()
.