std::intrinsics

Function typed_swap

source
pub const unsafe fn typed_swap<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

x and y are readable and writable as T, and non-overlapping.