pub struct Event { /* private fields */ }
Expand description
An Event
is a clonable object that can be signaled once. Calls to .wait()
produce a future,
EventWait
, that can wait on that signal. Once the Event
has been signaled, all futures will
complete immediately.
Implementations§
Source§impl Event
impl Event
Sourcepub fn signal(&self) -> bool
pub fn signal(&self) -> bool
Signal the Event
. Once this is done, it cannot be undone. Any tasks waiting on this
Event
will be notified and its Future
implementation will complete.
Returns true if this Event
was the one that performed the signal operation.
Sourcepub fn wait(&self) -> EventWait ⓘ
pub fn wait(&self) -> EventWait ⓘ
Create a new EventWait
future that will complete after this event has been signaled.
If all signalers are dropped, this future will continue to return Poll::Pending
. To be
notified when all signalers are dropped without signaling, use wait_or_dropped
.
Sourcepub fn wait_or_dropped(&self) -> EventWaitResult ⓘ
pub fn wait_or_dropped(&self) -> EventWaitResult ⓘ
Create a new EventWaitResult
future that will complete after this event has been
signaled or all Event
clones have been dropped.
This future will output a Result<(), Dropped>
to indicate what has occurred.