pub const unsafe fn typed_swap_nonoverlapping<T>(x: *mut T, y: *mut T)
🔬This is a nightly-only experimental API. (
core_intrinsics
)Expand description
Non-overlapping typed swap of a single value.
The codegen backends will replace this with a better implementation when
T
is a simple type that can be loaded and stored as an immediate.
The stabilized form of this intrinsic is crate::mem::swap
.
§Safety
Behavior is undefined if any of the following conditions are violated:
-
Both
x
andy
must be valid for both reads and writes. -
Both
x
andy
must be properly aligned. -
The region of memory beginning at
x
must not overlap with the region of memory beginning aty
. -
The memory pointed by
x
andy
must both contain values of typeT
.