Skip to main content

AtomicStore

Trait AtomicStore 

Source
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§

Source

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:

  • dst must be valid for writes
  • dst must be aligned to size_of::<MaybeUninit<T>>() (note that on some platforms this can be bigger than align_of::<MaybeUninit<T>>()).
  • order must be SeqCst, Release, or Relaxed.
  • 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§

Source§

impl AtomicStore for i8

Source§

impl AtomicStore for i16

Source§

impl AtomicStore for i32

Source§

impl AtomicStore for i64

Source§

impl AtomicStore for isize

Source§

impl AtomicStore for u8

Source§

impl AtomicStore for u16

Source§

impl AtomicStore for u32

Source§

impl AtomicStore for u64

Available on x86 and non-atomic_maybe_uninit_no_cmpxchg8b only.
Source§

impl AtomicStore for usize

Implementors§