pub trait AtomicStore: Primitive {
    unsafe fn atomic_store(
        dst: *mut MaybeUninit<Self>,
        val: *const MaybeUninit<Self>,
        order: Ordering
    ); }
Expand description

Atomic store.

This trait is sealed and cannot be implemented for types outside of atomic-maybe-uninit.

Required Methods

Stores a value from val 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:

  • If Self is greater than the pointer width, dst must be valid for both reads and writes. Otherwise, dst must be valid for writes.
  • dst must be properly aligned to the size of Self. (For example, if Self is u128, dst must be aligned to 16-byte even if the alignment of u128 is 8-byte.)
  • dst must go through UnsafeCell::get.
  • dst must not overlap with val.
  • val must be valid for reads.
  • val must be properly aligned.
  • order must be SeqCst, Release, or Relaxed.

The rules for the validity of pointer follow the rules applied to functions exposed by the standard library’s ptr module, except that concurrent atomic operations on dst are allowed.

Implementations on Foreign Types

Implementors