Expand description
Cast between types with no conversion.
Most of these operations are inherently unsafe, but provided as strongly-typed wrappers to reduce the chance of typos ending up with even more unsafe functions. If you use the result in incorrect ways, it will cause undefined behaviour.
Functions
ptr⚠
Undefined behaviour if the argument does not satisfy the alignment of type
To
.Undefined behaviour if the argument does not satisfy the alignment of type
To
.Like normal
transmute
, but without the compile-time
check that the sizes of the input and output are the same. Despite the removal
of the compile-time check, this property must still hold, and there is
a debug_assert_eq
which checks that. All the rules and warnings from
transmute
still apply.Undefined behaviour if the argument is zero, or does not satisfy the alignment
of type
T
.