Struct futures_channel::oneshot::Receiver
source · 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.
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§
source§impl<T> FusedFuture for Receiver<T>
impl<T> FusedFuture for Receiver<T>
source§fn is_terminated(&self) -> bool
fn is_terminated(&self) -> bool
Returns
true
if the underlying future should no longer be polled.impl<T> Unpin for Receiver<T>
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> !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<F> IntoFuture for Fwhere
F: Future,
impl<F> IntoFuture for Fwhere
F: Future,
§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