Waiter

Struct Waiter 

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

A waiter that can put the current thread to sleep until it is woken up by the associated Waker.

By definition, a waiter belongs to the current thread, so it cannot be sent to another thread and its reference cannot be shared between threads.

Implementations§

Source§

impl Waiter

Source

pub closed spec fn rel_waker(self, waker: Arc<Waker>) -> bool

Checks if the input waker is the associated waker of the current waiter.

Source

pub closed spec fn waker_id(self) -> int

Abstract identity of the paired waker.

Source§

impl Waiter

Source

pub exec fn new_pair() -> ret : (Self, Arc<Waker>)

ensures
ret.0.rel_waker(ret.1),

Creates a waiter and its associated Waker.

Source

pub exec fn wait(&self)

Waits until the waiter is woken up by calling Waker::wake_up on the associated Waker.

This method returns immediately if the waiter has been woken since the end of the last call to this method (or since the waiter was created, if this method has not been called before). Otherwise, it puts the current thread to sleep until the waiter is woken up.

Source

pub exec fn wait_until_or_cancelled<F, R, FCancel, E>( &self, cond: F, cancel_cond: FCancel, ) -> ret : Result<R, E>
where F: FnMut() -> Option<R>, FCancel: Fn() -> Result<(), E>,

requires
cond.requires(()),
cancel_cond.requires(()),
ensures
match ret {
    Ok(res) => cond.ensures((), Some(res)),
    Err(e) => cancel_cond.ensures((), Err(e)),
},

Waits until some condition is met or the cancel condition becomes true.

This method will return Ok(_) if the condition returns Some(_), and will stop waiting if the cancel condition returns Err(_). In this situation, this method will return the Err(_) generated by the cancel condition.

Source

pub exec fn waker(&self) -> ret : Arc<Waker>

ensures
self.rel_waker(ret),

Gets the associated Waker of the current waiter.

Source

pub exec fn task(&self) -> &Arc<Task>

Returns the task that the associated waker will attempt to wake up.

Trait Implementations§

Source§

impl Drop for Waiter

Source§

exec fn drop(&mut self)

Source§

impl !Send for Waiter

Source§

impl !Sync for Waiter

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.

§

impl<T, VERUS_SPEC__A> FromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: From<T>,

§

fn obeys_from_spec() -> bool

§

fn from_spec(v: T) -> VERUS_SPEC__A

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.

§

impl<T, VERUS_SPEC__A> IntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: Into<T>,

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> T

§

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

§

fn obeys_into_spec() -> bool

§

fn into_spec(self) -> U

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

impl<T, VERUS_SPEC__A> TryFromSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryFrom<T>,

§

fn obeys_try_from_spec() -> bool

§

fn try_from_spec( v: T, ) -> Result<VERUS_SPEC__A, <VERUS_SPEC__A as TryFrom<T>>::Error>

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

impl<T, VERUS_SPEC__A> TryIntoSpec<T> for VERUS_SPEC__A
where VERUS_SPEC__A: TryInto<T>,

§

fn obeys_try_into_spec() -> bool

§

fn try_into_spec(self) -> Result<T, <VERUS_SPEC__A as TryInto<T>>::Error>

§

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

§

fn obeys_try_into_spec() -> bool

§

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