pub trait AtomicLoad: Primitive {
// Required method
unsafe fn atomic_load(
src: *const MaybeUninit<Self>,
order: Ordering,
) -> MaybeUninit<Self>;
}Expand description
Atomic load.
This trait is sealed and cannot be implemented for types outside of atomic-maybe-uninit.
Required Methods§
Sourceunsafe fn atomic_load(
src: *const MaybeUninit<Self>,
order: Ordering,
) -> MaybeUninit<Self>
unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>
Loads a value from src.
atomic_load takes an Ordering argument which describes the memory ordering of this operation.
Possible values are SeqCst, Acquire and Relaxed.
§Safety
Behavior is undefined if any of the following conditions are violated:
srcmust be valid for reads.srcmust be aligned tosize_of::<MaybeUninit<T>>()(note that on some platforms this can be bigger thanalign_of::<MaybeUninit<T>>()).ordermust beSeqCst,Acquire, orRelaxed.- You must adhere to the Memory model for atomic accesses. In particular, it is not allowed to mix conflicting atomic and non-atomic accesses, or atomic accesses of different sizes, without synchronization.
Compatibility with read-only memory applies only to relaxed operations with a register or smaller width.
See the “Atomic accesses to read-only memory” section in the core::sync::atomic docs
for more.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".