StdEvent

Struct StdEvent 

Source
pub struct StdEvent { /* private fields */ }
Expand description

An implementation of Event and TimedEvent using std::thread.

Trait Implementations§

Source§

impl Debug for StdEvent

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Event for StdEvent

Source§

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>)

Blocks the caller until the another thread (or previously on the same thread) invokes Event::set.
Source§

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

Source§

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

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.
Source§

impl Sync for StdEvent

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.