Struct Event
pub struct Event { /* private fields */ }
Available on crate feature
threading
only.Expand description
An Event
, allowing to notify multiple threads that some event has happened.
An Event
manages an internal flag that can be set to true with the Self::set()
method and reset
to false with the Self::clear()
method. The Self::wait()
method blocks until the flag is set to true. The
flag is set to false initially.
Implementations§
§impl Event
impl Event
pub fn wait(&self)
pub fn wait(&self)
pub fn clear(&self) -> bool
pub fn clear(&self) -> bool
Clears the event (non-blocking).
If the event was set, it will be cleared and the function returns true. If the event was unset, the function returns false.
pub fn set(&self)
pub fn set(&self)
Sets the event.
If the event was unset, and there were waiters, all waiters will be woken up. If the event was already set, the function just returns.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Event
impl !RefUnwindSafe for Event
impl Send for Event
impl Unpin for Event
impl UnwindSafe for Event
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