Module bytemuck::checked

source ·
Expand description

Checked versions of the casting functions exposed in crate root that support CheckedBitPattern types.

Enums

The things that can go wrong when casting between CheckedBitPattern data forms.

Traits

A marker trait that allows types that have some invalid bit patterns to be used in places that otherwise require AnyBitPattern or Pod types by performing a runtime check on a perticular set of bits. This is particularly useful for types like fieldless (‘C-style’) enums, char, bool, and structs containing them.

Functions

Cast T into U
Cast &mut T into &mut U.
Cast &T into &U.
Cast &[A] into &[B].
Cast &mut [T] into &mut [U].
Re-interprets &[u8] as &T.
Re-interprets &mut [u8] as &mut T.
Reads the slice into a T value.
Try to cast T into U.
Try to convert a &mut T into &mut U.
Try to convert a &T into &U.
Try to convert &[A] into &[B] (possibly with a change in length).
Try to convert &mut [A] into &mut [B] (possibly with a change in length).
Re-interprets &[u8] as &T.
Re-interprets &mut [u8] as &mut T.
Reads from the bytes as if they were a T.