pub(super) struct AtomicState(AtomicUsize);
Expand description
The state stored in an atomic integer.
The Sender
uses Release
ordering for storing a new state
and the Receiver
s use Acquire
ordering for loading the
current state. This ensures that written values are seen by
the Receiver
s for a proper handover.
Tuple Fields§
§0: AtomicUsize
Implementations§
source§impl AtomicState
impl AtomicState
sourcepub(super) fn new() -> Self
pub(super) fn new() -> Self
Create a new AtomicState
that is not closed and which has the
version set to Version::INITIAL
.
sourcepub(super) fn load(&self) -> StateSnapshot
pub(super) fn load(&self) -> StateSnapshot
Load the current value of the state.
Only used by the receiver and for debugging purposes.
The receiver side (read-only) uses Acquire
ordering for a proper handover
of the shared value with the sender side (single writer). The state is always
updated after modifying and before releasing the (exclusive) lock on the
shared value.
sourcepub(super) fn increment_version_while_locked(&self)
pub(super) fn increment_version_while_locked(&self)
Increment the version counter.
sourcepub(super) fn set_closed(&self)
pub(super) fn set_closed(&self)
Set the closed bit in the state.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for AtomicState
impl RefUnwindSafe for AtomicState
impl Send for AtomicState
impl Sync for AtomicState
impl Unpin for AtomicState
impl UnwindSafe for AtomicState
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more