pub struct WakerRef<'a> { /* private fields */ }
Expand description
A Waker
that is only valid for a given lifetime.
Note: this type implements Deref<Target = Waker>
,
so it can be used to get a &Waker
.
Implementations§
Source§impl<'a> WakerRef<'a>
impl<'a> WakerRef<'a>
Sourcepub fn new_unowned(waker: ManuallyDrop<Waker>) -> WakerRef<'a>
pub fn new_unowned(waker: ManuallyDrop<Waker>) -> WakerRef<'a>
Methods from Deref<Target = Waker>§
1.36.0 · Sourcepub fn wake_by_ref(&self)
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 · Sourcepub fn will_wake(&self, other: &Waker) -> bool
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 Waker
s would awaken the same task. However, if this function
returns true
, it is guaranteed that the Waker
s 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.
1.83.0 · Sourcepub fn vtable(&self) -> &'static RawWakerVTable
pub fn vtable(&self) -> &'static RawWakerVTable
Gets the vtable
pointer used to create this Waker
.
Trait Implementations§
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> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Layout§
Note: Most layout information is completely unstable and may even differ between compilations. The only exception is types with certain repr(...)
attributes. Please see the Rust Reference's “Type Layout” chapter for details on type layout guarantees.
Size: 16 bytes