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
.