pub trait AtomicStore: Primitive {
// Provided method
unsafe fn atomic_store(
dst: *mut MaybeUninit<Self>,
val: MaybeUninit<Self>,
order: Ordering,
) { ... }
}Expand description
Atomic store.
This trait is sealed and cannot be implemented for types outside of atomic-maybe-uninit.
Provided Methods§
Sourceunsafe fn atomic_store(
dst: *mut MaybeUninit<Self>,
val: MaybeUninit<Self>,
order: Ordering,
)
unsafe fn atomic_store( dst: *mut MaybeUninit<Self>, val: MaybeUninit<Self>, order: Ordering, )
Stores a value into dst.
atomic_store takes an Ordering argument which describes the memory ordering of this operation.
Possible values are SeqCst, Release and Relaxed.
§Safety
Behavior is undefined if any of the following conditions are violated:
dstmust be valid for writesdstmust be aligned tosize_of::<MaybeUninit<T>>()(note that on some platforms this can be bigger thanalign_of::<MaybeUninit<T>>()).ordermust beSeqCst,Release, 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 write-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".
Implementations on Foreign Types§
impl AtomicStore for i8
impl AtomicStore for i16
impl AtomicStore for i32
impl AtomicStore for i64
impl AtomicStore for isize
impl AtomicStore for u8
impl AtomicStore for u16
impl AtomicStore for u32
impl AtomicStore for u64
Available on x86 and non-
atomic_maybe_uninit_no_cmpxchg8b only.