Module checked

Source
Expand description

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

Enums§

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

Traits§

CheckedBitPattern
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
Cast A into B
cast_mut
Cast &mut A into &mut B.
cast_ref
Cast &A into &B.
cast_slice
Cast &[A] into &[B].
cast_slice_mut
Cast &mut [A] into &mut [B].
from_bytes
Re-interprets &[u8] as &T.
from_bytes_mut
Re-interprets &mut [u8] as &mut T.
pod_read_unaligned
Reads the slice into a T value.
try_cast
Try to cast A into B.
try_cast_mut
Try to convert a &mut A into &mut B.
try_cast_ref
Try to convert a &A into &B.
try_cast_slice
Try to convert &[A] into &[B] (possibly with a change in length).
try_cast_slice_mut
Try to convert &mut [A] into &mut [B] (possibly with a change in length).
try_from_bytes
Re-interprets &[u8] as &T.
try_from_bytes_mut
Re-interprets &mut [u8] as &mut T.
try_pod_read_unaligned
Reads from the bytes as if they were a T.