pub struct AtomicFlags<F>{ /* private fields */ }Expand description
A flag set stored in an atomic integer.
Implementations§
Source§impl<F> AtomicFlags<F>
impl<F> AtomicFlags<F>
pub fn new(flags: F) -> Self
pub fn store(&self, flags: F, ordering: Ordering)
pub fn load(&self, ordering: Ordering) -> F
Sourcepub fn fetch_and(&self, flags: F, ordering: Ordering) -> F
pub fn fetch_and(&self, flags: F, ordering: Ordering) -> F
Atomically clears flags, returning the previous value.
Sourcepub fn fetch_or(&self, flags: F, ordering: Ordering) -> F
pub fn fetch_or(&self, flags: F, ordering: Ordering) -> F
Atomically sets flags, returning the previous value.
Sourcepub fn fetch_xor(&self, flags: F, ordering: Ordering) -> F
pub fn fetch_xor(&self, flags: F, ordering: Ordering) -> F
Atomically toggles flags, returning the previous value.
Sourcepub fn fetch_nand(&self, flags: F, ordering: Ordering) -> F
pub fn fetch_nand(&self, flags: F, ordering: Ordering) -> F
Atomically replaces the value with !(current & flags), returning the
previous value.
This follows the standard atomic fetch_nand: the result is not
restricted to flags, so bits outside the mask are set.
Sourcepub fn swap(&self, flags: F, ordering: Ordering) -> F
pub fn swap(&self, flags: F, ordering: Ordering) -> F
Atomically replaces the value with flags, returning the previous value.
Sourcepub fn take(&self, flags: F, ordering: Ordering) -> F
pub fn take(&self, flags: F, ordering: Ordering) -> F
Atomically clears flags and returns the subset that was set.
Returns an empty set if none of flags were set. Other bits are left
untouched.
Sourcepub fn peek(&self, flags: F, ordering: Ordering) -> F
pub fn peek(&self, flags: F, ordering: Ordering) -> F
Returns the subset of flags that is currently set.
Does not modify the stored value. The result is a snapshot from a single
load; use take to claim flags atomically.
Sourcepub fn into_inner(self) -> F
pub fn into_inner(self) -> F
Consumes the atomic and returns the flags.