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 ifptr
is aligned to analign
memory boundary. - pod_
read_ π βunaligned Reads the slice into aT
value. - something_
went_ πwrong Immediately panics. - try_
cast π βTry to castA
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 aT
.