[][src]Struct waitlist::WaitHandle

pub struct WaitHandle<'a> { /* fields omitted */ }

Methods

impl<'_> WaitHandle<'_>[src]

pub fn finish(&mut self) -> bool[src]

Mark this task as completed.

If this handle still has a waker on the queue, remove that waker without triggering another notify and return true. Otherwise, return false.

pub fn cancel(&mut self) -> bool[src]

Mark that the task was cancelled.

If this handle currently has a waker on the queue and there is at least one other task waiting on the queue, remove this waker from the queue, wake the next task, and return true. Otherwise return false.

pub fn set_context(&mut self, cx: &Context)[src]

pub fn is_pending(&self) -> bool[src]

Return true if the WaitHandle has been polled at least once, and has not been completed (by calling either finish or cancel).

pub fn try_finish(&mut self, cx: &mut Context) -> bool[src]

Mark as finished if this was notified, otherwise update the context.

This is roughly equivalent to

let did_finish = if handle.finish() {
  handle.set_context(&cx);
  false
} else {
  true
};

but operates atomically on the waitlist.

pub fn into_key(self) -> Option<usize>[src]

pub fn from_key(waitlist: &Waitlist, key: Option<usize>) -> WaitHandle[src]

Create a WaitHandle for a Waitlist using a key that was previously acquired from into_key.

For this to work as expected, key should be a key returned by a previous call to into_key on a WaitHandle that was created from the same waitlist. This takes ownership of the wait entry for this key.

You should avoid using this if possible, but in some cases it is necessary to avoid self-reference.

Trait Implementations

impl<'a> Drop for WaitHandle<'a>[src]

Auto Trait Implementations

impl<'a> RefUnwindSafe for WaitHandle<'a>

impl<'a> Send for WaitHandle<'a>

impl<'a> Sync for WaitHandle<'a>

impl<'a> Unpin for WaitHandle<'a>

impl<'a> UnwindSafe for WaitHandle<'a>

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.