pub struct StdEvent { /* private fields */ }Expand description
An implementation of Event and TimedEvent using std::thread.
Trait Implementations§
Source§impl Event for StdEvent
impl Event for StdEvent
Source§fn with(f: impl FnOnce(Pin<&Self>))
fn with(f: impl FnOnce(Pin<&Self>))
Construct a pinned Event, allowing the closure to call
wait on the Event reference.Source§fn wait(self: Pin<&Self>)
fn wait(self: Pin<&Self>)
Blocks the caller until the another thread (or previously on the same thread)
invokes
Event::set.Source§fn set(self: Pin<&Self>)
fn set(self: Pin<&Self>)
Marks the thread as active and unblocks the waiting thread if any.
Further attempts to call
Event::wait should return immediately.Source§impl TimedEvent for StdEvent
impl TimedEvent for StdEvent
Source§type Duration = Duration
type Duration = Duration
A timeout value used to represent the maximum amount of time to block the caller when waiting.
Source§fn try_wait_for(self: Pin<&Self>, timeout: Self::Duration) -> bool
fn try_wait_for(self: Pin<&Self>, timeout: Self::Duration) -> bool
Similar to
Event::wait, but takes in a maximum amount of time to block in case the Event is not set.
Returns true if the Event was set and returns false if the caller timed out trying to wait for the Event to be set.impl Sync for StdEvent
Auto Trait Implementations§
impl !Freeze for StdEvent
impl !RefUnwindSafe for StdEvent
impl Send for StdEvent
impl !Unpin for StdEvent
impl UnwindSafe for StdEvent
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