Struct rendezvous::Receiver
source · pub struct Receiver<T: Send, P: DeadlockPrevention = Spin> { /* private fields */ }
Expand description
The receiver side of a channel.
Implementations§
source§impl<T: Send, P: DeadlockPrevention> Receiver<T, P>
impl<T: Send, P: DeadlockPrevention> Receiver<T, P>
sourcepub fn receive(&self) -> Result<T, &'static str>
pub fn receive(&self) -> Result<T, &'static str>
Receive a message, blocking until a sender is ready.
Returns the message if it was received properly, otherwise returns an error.
sourcepub fn try_receive(&self) -> Result<T, &'static str>
pub fn try_receive(&self) -> Result<T, &'static str>
Tries to receive a message, only succeeding if a sender is ready and waiting.
If the sender was not ready, it returns an error without blocking.
Note that if the non-blocking try_send
and try_receive
functions are only ever used,
then the message will never be delivered because the sender and receiver cannot possibly rendezvous.
Trait Implementations§
Auto Trait Implementations§
impl<T, P = Spin> !RefUnwindSafe for Receiver<T, P>
impl<T, P> Send for Receiver<T, P>
impl<T, P> Sync for Receiver<T, P>
impl<T, P> Unpin for Receiver<T, P>
impl<T, P = Spin> !UnwindSafe for Receiver<T, P>
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