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
xandymust be valid for both reads and writes. -
Both
xandymust be properly aligned. -
The region of memory beginning at
xmust not overlap with the region of memory beginning aty. -
The memory pointed by
xandymust both contain values of typeT.