Struct tokio::util::wake::WakerRef

source ·
pub(crate) struct WakerRef<'a> {
    waker: ManuallyDrop<Waker>,
    _p: PhantomData<&'a ()>,
}
Expand description

A Waker that is only valid for a given lifetime.

Fields§

§waker: ManuallyDrop<Waker>§_p: PhantomData<&'a ()>

Methods from Deref<Target = Waker>§

1.36.0 · source

pub fn wake_by_ref(&self)

Wakes up the task associated with this Waker without consuming the Waker.

This is similar to wake(), but may be slightly less efficient in the case where an owned Waker is available. This method should be preferred to calling waker.clone().wake().

1.36.0 · source

pub fn will_wake(&self, other: &Waker) -> bool

Returns true if this Waker and another Waker would awake the same task.

This function works on a best-effort basis, and may return false even when the Wakers would awaken the same task. However, if this function returns true, it is guaranteed that the Wakers will awaken the same task.

This function is primarily used for optimization purposes — for example, this type’s clone_from implementation uses it to avoid cloning the waker when they would wake the same task anyway.

source

pub fn as_raw(&self) -> &RawWaker

🔬This is a nightly-only experimental API. (waker_getters)

Gets a reference to the underlying RawWaker.

Trait Implementations§

source§

impl<'a> Debug for WakerRef<'a>

source§

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

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

impl Deref for WakerRef<'_>

source§

type Target = Waker

The resulting type after dereferencing.
source§

fn deref(&self) -> &Waker

Dereferences the value.

Auto Trait Implementations§

§

impl<'a> Freeze for WakerRef<'a>

§

impl<'a> RefUnwindSafe for WakerRef<'a>

§

impl<'a> Send for WakerRef<'a>

§

impl<'a> Sync for WakerRef<'a>

§

impl<'a> Unpin for WakerRef<'a>

§

impl<'a> UnwindSafe for WakerRef<'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.