AtomicWaker

Struct AtomicWaker 

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

Atomic waker storage with state machine synchronization

带有状态机同步的原子 waker 存储

Implementations§

Source§

impl AtomicWaker

Source

pub fn new() -> Self

Create a new atomic waker

创建一个新的原子 waker

Source

pub fn register(&self, waker: &Waker)

Register a waker to be notified

This will store the waker and handle concurrent access safely. If a concurrent wake happens during registration, the newly registered waker will be woken immediately.

注册一个要通知的 waker

这将存储 waker 并安全地处理并发访问。 如果在注册期间发生并发唤醒,新注册的 waker 将立即被唤醒。

Source

pub fn take(&self) -> Option<Waker>

Take the waker out for waking

Returns the waker if one was registered, None otherwise. This atomically removes the waker from storage.

取出 waker 用于唤醒

如果注册了 waker 则返回它,否则返回 None。 这会原子地从存储中移除 waker。

Source

pub fn wake(&self)

Wake the registered waker if any

唤醒已注册的 waker(如果有)

Trait Implementations§

Source§

impl Debug for AtomicWaker

Source§

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

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

impl Drop for AtomicWaker

Source§

fn drop(&mut self)

Executes the destructor for this type. Read more
Source§

impl Send for AtomicWaker

Source§

impl Sync for AtomicWaker

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.

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.