Expand description
Checked versions of the casting functions exposed in crate root
that support CheckedBitPattern
types.
Enums§
- Checked
Cast Error - The things that can go wrong when casting between
CheckedBitPattern
data forms.
Traits§
- Checked
BitPattern - A marker trait that allows types that have some invalid bit patterns to be
used in places that otherwise require
AnyBitPattern
orPod
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
intoB
- 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
intoB
. - 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
.