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.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Event
impl !RefUnwindSafe for Event
impl Send for Event
impl Sync 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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§unsafe fn clone_to_uninit(&self, dst: *mut T)
unsafe fn clone_to_uninit(&self, dst: *mut T)
clone_to_uninit
)