bytemuck::checked

Function try_pod_read_unaligned

Source
pub fn try_pod_read_unaligned<T: CheckedBitPattern>(
    bytes: &[u8],
) -> Result<T, CheckedCastError>
Expand description

Reads from the bytes as if they were a T.

ยงFailure

  • If the bytes length is not equal to size_of::<T>().
  • If the slice contains an invalid bit pattern for T