Parked

Struct Parked 

Source
pub struct Parked<'a> { /* private fields */ }
Expand description

Proof of parking.

Park functions return Parked objects as a proof of having called Park::race_free(). This is necessary because Park::race_free() updates executor state and must always be run. Parked can be used by park functions to determine whether blocking or sleeping is permissible. See Park documentation for the correct parking protocol.

Implementations§

Source§

impl Parked<'_>

Source

pub fn is_idle(&self) -> bool

Check whether useful work is certainly not possible until an event is raised.

Unlike the calling of the park function, this is not an optimistic operation. Its result will be exact as long as the Park protocol is correctly followed. A return value of false prohibits the park function from sleeping at all: it should yield control to the executor immediately. A return value of true is a strong hint to sleep, block, or otherwise take over control flow until some unspecified condition, ideally until an event is raised.

See also the Park protocol.

Auto Trait Implementations§

§

impl<'a> Freeze for Parked<'a>

§

impl<'a> RefUnwindSafe for Parked<'a>

§

impl<'a> Send for Parked<'a>

§

impl<'a> Sync for Parked<'a>

§

impl<'a> Unpin for Parked<'a>

§

impl<'a> UnwindSafe for Parked<'a>

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.