atomic_maybe_uninit::raw

Trait AtomicLoad

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

Source

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:

  • 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.)
  • order must be SeqCst, Acquire, or Relaxed.

The rules for the validity of the pointer follow the rules applied to functions exposed by the standard library’s ptr module, except that concurrent atomic operations on src are allowed if the pointer go through UnsafeCell::get.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementations on Foreign Types§

Source§

impl AtomicLoad for i8

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Source§

impl AtomicLoad for i16

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Source§

impl AtomicLoad for i32

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Source§

impl AtomicLoad for i64

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Source§

impl AtomicLoad for i128

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Source§

impl AtomicLoad for isize

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Source§

impl AtomicLoad for u8

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Source§

impl AtomicLoad for u16

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Source§

impl AtomicLoad for u32

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Source§

impl AtomicLoad for u64

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Source§

impl AtomicLoad for u128

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Source§

impl AtomicLoad for usize

Source§

unsafe fn atomic_load( src: *const MaybeUninit<Self>, order: Ordering, ) -> MaybeUninit<Self>

Implementors§