pub struct CountedSignal { /* private fields */ }Expand description
A saturating SPSC counter for payload-free events.
Exactly one Producer and one Consumer may be active at a time.
Handles are Send + !Sync: each can move to another execution context,
but cannot be shared between contexts. Dropping a handle releases its slot.
u32::MAX is the saturation sentinel. Counts below it are exact; a
saturated snapshot means that at least u32::MAX increments occurred
since the preceding take.
Implementations§
Source§impl CountedSignal
impl CountedSignal
Sourcepub fn try_producer(&self) -> Option<Producer<'_>>
pub fn try_producer(&self) -> Option<Producer<'_>>
Try to acquire the sole producer handle.
Returns None while another producer handle is active.
Sourcepub fn try_consumer(&self) -> Option<Consumer<'_>>
pub fn try_consumer(&self) -> Option<Consumer<'_>>
Try to acquire the sole consumer handle.
Returns None while another consumer handle is active.
Trait Implementations§
Source§impl Debug for CountedSignal
impl Debug for CountedSignal
Auto Trait Implementations§
impl !Freeze for CountedSignal
impl RefUnwindSafe for CountedSignal
impl Send for CountedSignal
impl Sync for CountedSignal
impl Unpin for CountedSignal
impl UnsafeUnpin for CountedSignal
impl UnwindSafe for CountedSignal
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