Function bytemuck::internal::try_from_bytes

source ·
pub(crate) unsafe fn try_from_bytes<T: Copy>(
    s: &[u8],
) -> Result<&T, PodCastError>
Expand description

Re-interprets &[u8] as &T.

§Failure

  • If the slice isn’t aligned for the new type
  • If the slice’s length isn’t exactly the size of the new type