pub struct Receiver<T> { /* private fields */ }Expand description
Receives the value of the Sender; a future.
Cancel safe: dropping the future before it completes loses nothing the channel still holds (a value sent later is dropped with the receiver).
Implementations§
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
Sourcepub fn close(&mut self)
pub fn close(&mut self)
Closes the receiving half: a later send fails and gets its value back. A value sent before the close stays receivable.
Sourcepub fn is_terminated(&self) -> bool
pub fn is_terminated(&self) -> bool
Whether the receiver completed or failed already.
Sourcepub fn try_recv(&mut self) -> Result<T, TryRecvError>
pub fn try_recv(&mut self) -> Result<T, TryRecvError>
Receives the value without waiting.
§Errors
TryRecvError::Empty if no value was sent yet and the sender is
still there; TryRecvError::Closed if the sender dropped without
sending, the receiver was closed empty, or the value was received.
Trait Implementations§
Auto Trait Implementations§
impl<T> !RefUnwindSafe for Receiver<T>
impl<T> !Send for Receiver<T>
impl<T> !Sync for Receiver<T>
impl<T> !UnwindSafe for Receiver<T>
impl<T> Freeze for Receiver<T>
impl<T> Unpin for Receiver<T>
impl<T> UnsafeUnpin 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
Source§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§type IntoFuture = F
type IntoFuture = F
Which kind of future are we turning this into?
Source§fn into_future(self) -> <F as IntoFuture>::IntoFuture
fn into_future(self) -> <F as IntoFuture>::IntoFuture
Creates a future from a value. Read more