Function bytemuck::checked::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