Expand description
Internal implementation of casting functions not bound by marker traits
and therefore marked as unsafe. This is used so that we donβt need to
duplicate the business logic contained in these functions between the
versions exported in the crate root, checked
, and relaxed
modules.
Functions§
- bytes_of π βRe-interprets
&T
as&[u8]
. - bytes_of_mut π βRe-interprets
&mut T
as&mut [u8]
. - 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
. - is_aligned_to πChecks if
ptr
is aligned to analign
memory boundary. - pod_read_unaligned π βReads the slice into a
T
value. - something_went_wrong πImmediately panics.
- 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
.