[][src]Struct task_notify::Notify

pub struct Notify<T> { /* fields omitted */ }

A wrapper which wakes tasks on mutable accesses to the wrapped value.

This can be used to transparently notify an asyncronous task that it should, for example, check for more work in a queue or try again to acquire a lock.

Implementations

impl<T> Notify<T>[src]

pub fn new(inner: T) -> Self[src]

pub fn has_waker(ptr: &Notify<T>) -> bool[src]

Check whether or not this Notify has a registered Waker.

This function is implemented as an associated function rather than a method to avoid conflicts with methods on the wrapped type. Call it as Notify::has_waker().

pub fn waker(ptr: &mut Notify<T>) -> Option<Waker>[src]

Get a copy of the registered Waker for this Notify.

This function is implemented as an associated function rather than a method to avoid conflicts with methods on the wrapped type. Call it as Notify::waker().

pub fn wake(ptr: &mut Notify<T>)[src]

Call wake on the waker, if it's a waker, yehaa!

pub fn register_waker(ptr: &mut Notify<T>, waker: &Waker)[src]

Register a Waker to be woken upon mutable accesses to the wrapped value.

This function is implemented as an associated function rather than a method to avoid conflicts with methods on the wrapped type. Call it as Notify::register_waker().

Panics

Panics if there is an already registered Waker. Use Notify::has_waker to check the state before using this.

pub fn clear_waker(ptr: &mut Notify<T>) -> Option<Waker>[src]

Removes and returns the Waker registered to this Notify.

This function is implemented as an associated function rather than a method to avoid conflicts with methods on the wrapped type. Call it as Notify::clear_waker().

pub fn into_inner(ptr: Notify<T>) -> T[src]

Consumes the Notify, dropping any associated Waker and returning the inner value without notifying the Waker.

This function is implemented as an associated function rather than a method to avoid conflicts with methods on the wrapped type. Call it as Notify::into_inner().

Trait Implementations

impl<T: Clone> Clone for Notify<T>[src]

impl<T: Debug> Debug for Notify<T>[src]

impl<T: Default> Default for Notify<T>[src]

impl<T> Deref for Notify<T>[src]

type Target = T

The resulting type after dereferencing.

impl<T> DerefMut for Notify<T>[src]

Auto Trait Implementations

impl<T> RefUnwindSafe for Notify<T> where
    T: RefUnwindSafe
[src]

impl<T> Send for Notify<T> where
    T: Send
[src]

impl<T> Sync for Notify<T> where
    T: Sync
[src]

impl<T> Unpin for Notify<T> where
    T: Unpin
[src]

impl<T> UnwindSafe for Notify<T> where
    T: UnwindSafe
[src]

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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.