Struct atomic_maybe_uninit::AtomicMaybeUninit
source · [−]#[repr(C)]pub struct AtomicMaybeUninit<T: Primitive> { /* private fields */ }Expand description
A potentially uninitialized integer type which can be safely shared between threads.
This type has the same in-memory representation as the underlying
integer type, T.
Implementations
sourceimpl<T: Primitive> AtomicMaybeUninit<T>
impl<T: Primitive> AtomicMaybeUninit<T>
sourcepub const fn new(v: MaybeUninit<T>) -> Self
pub const fn new(v: MaybeUninit<T>) -> Self
Creates a new atomic integer.
This is const fn on Rust 1.61+. See also const_new function.
sourcepub fn get_mut(&mut self) -> &mut MaybeUninit<T>
pub fn get_mut(&mut self) -> &mut MaybeUninit<T>
Returns a mutable reference to the underlying integer.
This is safe because the mutable reference guarantees that no other threads are concurrently accessing the atomic data.
sourcepub fn into_inner(self) -> MaybeUninit<T>
pub fn into_inner(self) -> MaybeUninit<T>
Consumes the atomic and returns the contained value.
This is safe because passing self by value guarantees that no other threads are
concurrently accessing the atomic data.
sourcepub fn load(&self, order: Ordering) -> MaybeUninit<T> where
T: AtomicLoad,
pub fn load(&self, order: Ordering) -> MaybeUninit<T> where
T: AtomicLoad,
sourcepub fn store(&self, val: MaybeUninit<T>, order: Ordering) where
T: AtomicStore,
pub fn store(&self, val: MaybeUninit<T>, order: Ordering) where
T: AtomicStore,
sourcepub fn swap(&self, val: MaybeUninit<T>, order: Ordering) -> MaybeUninit<T> where
T: AtomicSwap,
pub fn swap(&self, val: MaybeUninit<T>, order: Ordering) -> MaybeUninit<T> where
T: AtomicSwap,
Stores a value into the atomic integer, returning the previous value.
swap takes an Ordering argument which describes the memory ordering
of this operation. All ordering modes are possible. Note that using
Acquire makes the store part of this operation Relaxed, and
using Release makes the load part Relaxed.
sourceimpl AtomicMaybeUninit<i8>
impl AtomicMaybeUninit<i8>
sourcepub const fn const_new(v: MaybeUninit<i8>) -> Self
pub const fn const_new(v: MaybeUninit<i8>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
sourceimpl AtomicMaybeUninit<u8>
impl AtomicMaybeUninit<u8>
sourcepub const fn const_new(v: MaybeUninit<u8>) -> Self
pub const fn const_new(v: MaybeUninit<u8>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
sourceimpl AtomicMaybeUninit<i16>
impl AtomicMaybeUninit<i16>
sourcepub const fn const_new(v: MaybeUninit<i16>) -> Self
pub const fn const_new(v: MaybeUninit<i16>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
sourceimpl AtomicMaybeUninit<u16>
impl AtomicMaybeUninit<u16>
sourcepub const fn const_new(v: MaybeUninit<u16>) -> Self
pub const fn const_new(v: MaybeUninit<u16>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
sourceimpl AtomicMaybeUninit<i32>
impl AtomicMaybeUninit<i32>
sourcepub const fn const_new(v: MaybeUninit<i32>) -> Self
pub const fn const_new(v: MaybeUninit<i32>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
sourceimpl AtomicMaybeUninit<u32>
impl AtomicMaybeUninit<u32>
sourcepub const fn const_new(v: MaybeUninit<u32>) -> Self
pub const fn const_new(v: MaybeUninit<u32>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
sourceimpl AtomicMaybeUninit<i64>
impl AtomicMaybeUninit<i64>
sourcepub const fn const_new(v: MaybeUninit<i64>) -> Self
pub const fn const_new(v: MaybeUninit<i64>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
sourceimpl AtomicMaybeUninit<u64>
impl AtomicMaybeUninit<u64>
sourcepub const fn const_new(v: MaybeUninit<u64>) -> Self
pub const fn const_new(v: MaybeUninit<u64>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
sourceimpl AtomicMaybeUninit<i128>
impl AtomicMaybeUninit<i128>
sourcepub const fn const_new(v: MaybeUninit<i128>) -> Self
pub const fn const_new(v: MaybeUninit<i128>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
sourceimpl AtomicMaybeUninit<u128>
impl AtomicMaybeUninit<u128>
sourcepub const fn const_new(v: MaybeUninit<u128>) -> Self
pub const fn const_new(v: MaybeUninit<u128>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
sourceimpl AtomicMaybeUninit<isize>
impl AtomicMaybeUninit<isize>
sourcepub const fn const_new(v: MaybeUninit<isize>) -> Self
pub const fn const_new(v: MaybeUninit<isize>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
sourceimpl AtomicMaybeUninit<usize>
impl AtomicMaybeUninit<usize>
sourcepub const fn const_new(v: MaybeUninit<usize>) -> Self
pub const fn const_new(v: MaybeUninit<usize>) -> Self
Creates a new atomic integer. Unlike new, this is always const fn.
Trait Implementations
sourceimpl<T: Primitive> Debug for AtomicMaybeUninit<T>
impl<T: Primitive> Debug for AtomicMaybeUninit<T>
sourceimpl<T: Primitive> From<MaybeUninit<T>> for AtomicMaybeUninit<T>
impl<T: Primitive> From<MaybeUninit<T>> for AtomicMaybeUninit<T>
sourcefn from(v: MaybeUninit<T>) -> Self
fn from(v: MaybeUninit<T>) -> Self
Performs the conversion.
sourceimpl<T: Primitive> From<T> for AtomicMaybeUninit<T>
impl<T: Primitive> From<T> for AtomicMaybeUninit<T>
impl<T: Primitive> RefUnwindSafe for AtomicMaybeUninit<T>
impl<T: Primitive> Sync for AtomicMaybeUninit<T>
Auto Trait Implementations
impl<T> Send for AtomicMaybeUninit<T>
impl<T> Unpin for AtomicMaybeUninit<T>
impl<T> UnwindSafe for AtomicMaybeUninit<T>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more