pub struct Sender<T> { /* private fields */ }
Expand description
The sending side of a channel.
Implementations§
Source§impl<T> Sender<T>
impl<T> Sender<T>
Sourcepub fn send_timeout<D>(&self, msg: T, timeout: D) -> Result<(), SendError<T>>
pub fn send_timeout<D>(&self, msg: T, timeout: D) -> Result<(), SendError<T>>
Waits for a message to be sent into the channel, but only for a limited time.
This call will block until the send operation can proceed or the operation times out.
For unbounded channels, this will perform an allocation (and always send immediately). For bounded channels, no allocation will be performed.
Sourcepub fn send(&self, msg: T) -> Result<(), SendError<T>>
pub fn send(&self, msg: T) -> Result<(), SendError<T>>
Sends a message over the given channel. Waiting if necessary.
For unbounded channels, this will allocate space for a message, and immediately send it. For bounded channels, this will block until a message slot is available, and then send the message.
Source§impl<T: Unpin> Sender<T>
impl<T: Unpin> Sender<T>
Sourcepub fn send_timeout_async<'a>(
&'a self,
msg: T,
timeout: impl Into<Timeout>,
) -> impl Future<Output = Result<(), SendError<T>>> + 'a
pub fn send_timeout_async<'a>( &'a self, msg: T, timeout: impl Into<Timeout>, ) -> impl Future<Output = Result<(), SendError<T>>> + 'a
Waits for a message to be sent into the channel, but only for a limited time. Async version.
This has the same behavior as send_timeout
, but as an Async function.
Sourcepub async fn send_async(&self, msg: T) -> Result<(), SendError<T>>
pub async fn send_async(&self, msg: T) -> Result<(), SendError<T>>
Sends a message over the given channel, waiting if necessary. Async version.