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
. - Checks if
ptr
is aligned to analign
memory boundary. - Reads the slice into a
T
value. - 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 to convert
&mut [A]
into&mut [B]
(possibly with a change in length). - try_
from_ 🔒 ⚠bytes Re-interprets&[u8]
as&T
. - Re-interprets
&mut [u8]
as&mut T
. - Reads from the bytes as if they were a
T
.