Struct rendezvous::Sender
source · pub struct Sender<T: Send, P: DeadlockPrevention = Spin> { /* private fields */ }
Expand description
The sender (transmit) side of a channel.
Implementations§
source§impl<T: Send, P: DeadlockPrevention> Sender<T, P>
impl<T: Send, P: DeadlockPrevention> Sender<T, P>
sourcepub fn send(&self, msg: T) -> Result<(), &'static str>
pub fn send(&self, msg: T) -> Result<(), &'static str>
Send a message, blocking until a receiver is ready.
Returns Ok(())
if the message was sent and received successfully,
otherwise returns an error.
sourcepub fn try_send(&self, _msg: T) -> Result<(), T>
pub fn try_send(&self, _msg: T) -> Result<(), T>
Tries to send the message, only succeeding if a receiver is ready and waiting.
If a receiver was not ready, it returns the msg
back to the caller 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 Sender<T, P>
impl<T, P> Send for Sender<T, P>
impl<T, P> Sync for Sender<T, P>
impl<T, P> Unpin for Sender<T, P>
impl<T, P = Spin> !UnwindSafe for Sender<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