Receiver

Type Alias Receiver 

Source
pub type Receiver<S> = Receiver<LiteStorage<S>>;
Expand description

Receiver for one-shot state transfer

用于一次性状态传递的接收器

Aliased Type§

pub struct Receiver<S> { /* private fields */ }

Implementations§

Source§

impl<S: State> Receiver<S>

Source

pub async fn recv(self) -> Result<S, RecvError>

Receive a value asynchronously

This is equivalent to using .await directly on the receiver

异步接收一个值

这等同于直接在 receiver 上使用 .await

Source

pub fn try_recv(&mut self) -> Result<S, TryRecvError>

Try to receive a value without blocking

Returns Ok(value) if value is ready, Err(TryRecvError::Empty) if pending, or Err(TryRecvError::Closed) if sender was dropped.

尝试接收值而不阻塞

如果值就绪返回 Ok(value),如果待处理返回 Err(TryRecvError::Empty), 如果发送器被丢弃返回 Err(TryRecvError::Closed)