pub trait AtomicLoad: Primitive {
    unsafe fn atomic_load(
        src: *const MaybeUninit<Self>,
        out: *mut MaybeUninit<Self>,
        order: Ordering
    ); }
Expand description

Atomic load.

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

Required Methods

Loads a value from src into out.

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:

  • If Self is greater than the pointer width, src must be valid for both reads and writes. Otherwise, src must be valid for reads.
  • src must be properly aligned to the size of Self. (For example, if Self is u128, src must be aligned to 16-byte even if the alignment of u128 is 8-byte.)
  • src must go through UnsafeCell::get.
  • src must not overlap with out.
  • out must be valid for writes.
  • out must be properly aligned.
  • order must be SeqCst, Acquire, 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 src are allowed.

Implementations on Foreign Types

Implementors