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 Receivers use Acquire ordering for loading the
current state. This ensures that written values are seen by
the Receivers for a proper handover.
Tuple Fields§
§0: AtomicUsizeImplementations§
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