pub struct AtomicU8(_);
Expand description
Mock implementation of std::sync::atomic::AtomicU8
.
NOTE: Unlike std::sync::atomic::AtomicU8
, this type has a different in-memory representation than u8
.
Implementations
sourceimpl AtomicU8
impl AtomicU8
sourcepub fn with_mut<R>(&mut self, f: impl FnOnce(&mut u8) -> R) -> R
pub fn with_mut<R>(&mut self, f: impl FnOnce(&mut u8) -> R) -> R
Get access to a mutable reference to the inner value.
sourcepub unsafe fn unsync_load(&self) -> u8
pub unsafe fn unsync_load(&self) -> u8
Load the value without any synchronization.
Safety
An unsynchronized atomic load technically always has undefined behavior. However, if the atomic value is not currently visible by other threads, this should always be equivalent to a non-atomic load of an un-shared integer value.
sourcepub fn swap(&self, val: u8, order: Ordering) -> u8
pub fn swap(&self, val: u8, order: Ordering) -> u8
Stores a value into the atomic integer, returning the previous value.
sourcepub fn compare_and_swap(&self, current: u8, new: u8, order: Ordering) -> u8
pub fn compare_and_swap(&self, current: u8, new: u8, order: Ordering) -> u8
Stores a value into the atomic integer if the current value is the same as the current
value.
sourcepub fn compare_exchange(
&self,
current: u8,
new: u8,
success: Ordering,
failure: Ordering
) -> Result<u8, u8>
pub fn compare_exchange(
&self,
current: u8,
new: u8,
success: Ordering,
failure: Ordering
) -> Result<u8, u8>
Stores a value into the atomic if the current value is the same as the current
value.
sourcepub fn compare_exchange_weak(
&self,
current: u8,
new: u8,
success: Ordering,
failure: Ordering
) -> Result<u8, u8>
pub fn compare_exchange_weak(
&self,
current: u8,
new: u8,
success: Ordering,
failure: Ordering
) -> Result<u8, u8>
Stores a value into the atomic if the current value is the same as the current value.
sourcepub fn fetch_add(&self, val: u8, order: Ordering) -> u8
pub fn fetch_add(&self, val: u8, order: Ordering) -> u8
Adds to the current value, returning the previous value.
sourcepub fn fetch_sub(&self, val: u8, order: Ordering) -> u8
pub fn fetch_sub(&self, val: u8, order: Ordering) -> u8
Subtracts from the current value, returning the previous value.
sourcepub fn fetch_nand(&self, val: u8, order: Ordering) -> u8
pub fn fetch_nand(&self, val: u8, order: Ordering) -> u8
Bitwise “nand” with the current value.
sourcepub fn fetch_max(&self, val: u8, order: Ordering) -> u8
pub fn fetch_max(&self, val: u8, order: Ordering) -> u8
Stores the maximum of the current and provided value, returning the previous value
sourcepub fn fetch_min(&self, val: u8, order: Ordering) -> u8
pub fn fetch_min(&self, val: u8, order: Ordering) -> u8
Stores the minimum of the current and provided value, returning the previous value
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for AtomicU8
impl Send for AtomicU8
impl Sync for AtomicU8
impl Unpin for AtomicU8
impl UnwindSafe for AtomicU8
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
sourceimpl<T> Instrument for T
impl<T> Instrument for T
sourcefn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
sourcefn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
sourceimpl<T> WithSubscriber for T
impl<T> WithSubscriber for T
sourcefn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self> where
S: Into<Dispatch>,
Attaches the provided Subscriber
to this type, returning a
WithDispatch
wrapper. Read more
sourcefn with_current_subscriber(self) -> WithDispatch<Self>
fn with_current_subscriber(self) -> WithDispatch<Self>
Attaches the current default Subscriber
to this type, returning a
WithDispatch
wrapper. Read more