Function try_pod_read_unaligned
pub fn try_pod_read_unaligned<T>(bytes: &[u8]) -> Result<T, CheckedCastError> ⓘwhere
T: CheckedBitPattern,
Available on crate feature
dep_bytemuck
only.Expand description
Reads from the bytes as if they were a T
.
§Failure
- If the
bytes
length is not equal tosize_of::<T>()
. - If the slice contains an invalid bit pattern for
T