pub struct MTx<T>(/* private fields */);Expand description
A multi-producer (sender) that works in a blocking context.
Inherits from Tx<T> and implements Clone.
Additional methods can be accessed through Deref<Target=[ChannelShared]>.
You can use into() to convert it to Tx<T>.
Methods from Deref<Target = Tx<T>>§
Sourcepub fn send(&self, item: T) -> Result<(), SendError<T>>
pub fn send(&self, item: T) -> Result<(), SendError<T>>
Sends a message. This method will block until the message is sent or the channel is closed.
Returns Ok(()) on success.
Returns Err(SendError) if the receiver has been dropped.
Sourcepub fn try_send(&self, item: T) -> Result<(), TrySendError<T>>
pub fn try_send(&self, item: T) -> Result<(), TrySendError<T>>
Attempts to send a message without blocking.
Returns Ok(()) when successful.
Returns Err(TrySendError::Full) if the channel is full.
Returns Err(TrySendError::Disconnected) if the receiver has been dropped.
Sourcepub fn send_timeout(
&self,
item: T,
timeout: Duration,
) -> Result<(), SendTimeoutError<T>>
pub fn send_timeout( &self, item: T, timeout: Duration, ) -> Result<(), SendTimeoutError<T>>
Sends a message with a timeout. Will block when channel is full.
The behavior is atomic: the message is either sent successfully or returned on error.
Returns Ok(()) when successful.
Returns Err(SendTimeoutError::Timeout) if the operation timed out.
Returns Err(SendTimeoutError::Disconnected) if the receiver has been dropped.