pub struct Receiver<T> { /* private fields */ }
Expand description
A future for a value that will be provided by another asynchronous task.
This is created by the channel
function.
Implementations§
Source§impl<T> Receiver<T>
impl<T> Receiver<T>
Sourcepub fn close(&mut self)
pub fn close(&mut self)
Gracefully close this receiver, preventing any subsequent attempts to send to it.
Any send
operation which happens after this method returns is
guaranteed to fail. After calling this method, you can use
Receiver::poll
to determine whether a message had
previously been sent.
Sourcepub fn try_recv(&mut self) -> Result<Option<T>, Canceled>
pub fn try_recv(&mut self) -> Result<Option<T>, Canceled>
Attempts to receive a message outside of the context of a task.
Useful when a Context
is not available such as within a
Drop
impl.
Does not schedule a task wakeup or have any other side effects.
A return value of None
must be considered immediately stale (out of
date) unless ::close
has been called first.
Returns an error if the sender was dropped.
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> !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
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left
is true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self
into a Left
variant of Either<Self, Self>
if into_left(&self)
returns true
.
Converts self
into a Right
variant of Either<Self, Self>
otherwise. Read moreSource§impl<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
Source§fn into_future(self) -> F
fn into_future(self) -> F
Consumes this object and produces a future.