devela::_dep::bytemuck

Function pod_read_unaligned

pub fn pod_read_unaligned<T>(bytes: &[u8]) -> T
where T: AnyBitPattern,
Available on crate feature dep_bytemuck only.
Expand description

Reads the slice into a T value.

Unlike from_bytes, the slice doesn’t need to respect alignment of T, only sizes must match.

§Panics

  • This is like try_pod_read_unaligned but will panic on failure.