Struct Receiver
#[must_use = "futures do nothing unless you `.await` or poll them"]
pub struct Receiver<T> { /* private fields */ }
A future for a value that will be provided by another asynchronous task.
This is created by the channel function.
Implementations
impl<T> Receiver<T>
fn close(&mut self)Gracefully close this receiver, preventing any subsequent attempts to send to it.
Any
sendoperation which happens after this method returns is guaranteed to fail. After calling this method, you can useReceiver::pollto determine whether a message had previously been sent.fn try_recv(&mut self) -> Result<Option<T>, Canceled>Attempts to receive a message outside of the context of a task.
Does not schedule a task wakeup or have any other side effects.
A return value of
Nonemust be considered immediately stale (out of date) unlessclosehas been called first.Returns an error if the sender was dropped.
Trait Implementations
impl<T> Debug for Receiver<T>
fn fmt(&self, f: &mut Formatter<'_>) -> Result
impl<T> Drop for Receiver<T>
fn drop(&mut self)
impl<T> FusedFuture for Receiver<T>
fn is_terminated(&self) -> bool
impl<T> Future for Receiver<T>
type Output = Result<T, Canceled>;fn poll(self: Pin<&mut Self>, cx: &mut Context<'_>) -> Poll<Result<T, Canceled>>
impl<T> Unpin for Receiver<T>
Auto Trait Implementations
impl<T> !RefUnwindSafe for Receiver<T>
impl<T> !UnwindSafe for Receiver<T>
impl<T> Freeze for Receiver<T>
where
Arc<Inner<T>>: Freeze,
impl<T> Send for Receiver<T>
where
Arc<Inner<T>>: Send,
impl<T> Sync for Receiver<T>
where
Arc<Inner<T>>: Sync,
impl<T> UnsafeUnpin for Receiver<T>
where
Arc<Inner<T>>: UnsafeUnpin,
Blanket Implementations
impl<F> IntoFuture for Receiver<T>
where
F: Future,
type Output = <F as Future>::Output;type IntoFuture = F;fn into_future(self) -> <F as IntoFuture>::IntoFuture
impl<F, T, E> TryFuture for Receiver<T>
where
F: Future<Output = Result<T, E>> + ?Sized,
type Ok = T;type Error = E;fn try_poll(self: Pin<&mut F>, cx: &mut Context<'_>) -> Poll<<F as Future>::Output>
impl<T> Any for Receiver<T>
where
T: 'static + ?Sized,
fn type_id(&self) -> TypeId
impl<T> Borrow<T> for Receiver<T>
where
T: ?Sized,
fn borrow(&self) -> &T
impl<T> BorrowMut<T> for Receiver<T>
where
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
impl<T> From<T> for Receiver<T>
fn from(t: T) -> TReturns the argument unchanged.
impl<T, U> Into<U> for Receiver<T>
where
U: From<T>,
fn into(self) -> UCalls
U::from(self).That is, this conversion is whatever the implementation of
[From]<T> for Uchooses to do.
impl<T, U> TryFrom<U> for Receiver<T>
where
U: Into<T>,
type Error = never;fn try_from(value: U) -> Result<T, never>
impl<T, U> TryInto<U> for Receiver<T>
where
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error;fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>