pub struct Receiver<T> { /* private fields */ }Expand description
Receiver side of the channel 通道的接收端
Implementations§
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
Sourcepub fn recv(&mut self) -> RecvFuture<'_, T> ⓘ
pub fn recv(&mut self) -> RecvFuture<'_, T> ⓘ
Receive a value from the channel 从通道接收值
Sourcepub fn try_recv(&mut self) -> Result<T, RecvError>
pub fn try_recv(&mut self) -> Result<T, RecvError>
Try to receive a value without blocking 尝试接收值而不阻塞
§Errors
Returns Err(RecvError::Closed) if the channel is empty and all senders are dropped.
如果通道为空且所有发送器已丢弃则返回 Err(RecvError::Closed)。
Returns Err(RecvError::Empty) if the channel is empty but senders still exist.
如果通道为空但发送器仍然存在则返回 Err(RecvError::Empty)。
§Panics
Panics if the internal mutex is poisoned (should never happen in normal operation). 如果内部互斥锁被污染则恐慌(正常操作中不应发生)。
Trait Implementations§
Auto Trait Implementations§
impl<T> Freeze for Receiver<T>
impl<T> RefUnwindSafe for Receiver<T>
impl<T> Send for Receiver<T>where
T: Send,
impl<T> Sync for Receiver<T>where
T: Send,
impl<T> Unpin for Receiver<T>
impl<T> UnsafeUnpin for Receiver<T>
impl<T> UnwindSafe for Receiver<T>
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
Mutably borrows from an owned value. Read more