Struct heph_inbox::oneshot::Receiver [−][src]
pub struct Receiver<T> { /* fields omitted */ }
Expand description
The receiving half of the one-shot channel.
This half can only be owned and used by one thread.
Implementations
impl<T> Receiver<T>
[src]
impl<T> Receiver<T>
[src]pub fn try_recv(&mut self) -> Result<T, RecvError>
[src]
pub fn try_recv(&mut self) -> Result<T, RecvError>
[src]Attempts to receive a value and reset the channel.
If it succeeds it returns the value and resets the channel, returning a
new Sender
(which can send a value to this Receiver
).
pub fn recv<'r>(&'r mut self) -> RecvValue<'r, T>ⓘ
[src]
pub fn recv<'r>(&'r mut self) -> RecvValue<'r, T>ⓘ
[src]Returns a future that receives a value from the channel, waiting if the channel is empty.
If the returned Future
returns None
it means the Sender
is
disconnected without sending a value. This is the same error as
RecvError::Disconnected
. RecvError::NoValue
will never be
returned, the Future
will return Poll::Pending
instead.
pub fn recv_once(self) -> RecvOnce<T>ⓘ
[src]
pub fn recv_once(self) -> RecvOnce<T>ⓘ
[src]Returns an owned version of Receiver::recv
that can only be used
once.
See Receiver::recv
for more information.
pub fn try_reset(&mut self) -> Option<Sender<T>>
[src]
pub fn try_reset(&mut self) -> Option<Sender<T>>
[src]Attempt to reset the channel.
If the sender is disconnected this will return a new Sender
. If the
sender is still connected this will return None
.
Notes
If the channel contains a value it will be dropped.
pub fn is_connected(&self) -> bool
[src]
pub fn is_connected(&self) -> bool
[src]Returns true
if the Sender
is connected.
pub fn register_waker(&mut self, waker: &Waker) -> bool
[src]
pub fn register_waker(&mut self, waker: &Waker) -> bool
[src]Set the receiver’s waker to waker
, if they are different. Returns
true
if the waker is changed, false
otherwise.
This is useful if you can’t call Receiver::recv
but still want a
wake-up notification once messages are added to the inbox.