pub trait Tx<M: RemoteMessage>: Debug {
// Required methods
fn do_post(&self, message: M, return_channel: Option<Sender<SendError<M>>>);
fn addr(&self) -> ChannelAddr;
fn status(&self) -> &Receiver<TxStatus>;
// Provided methods
fn try_post(&self, message: M, return_channel: Sender<SendError<M>>) { ... }
fn post(&self, message: M) { ... }
fn send<'life0, 'async_trait>(
&'life0 self,
message: M,
) -> Pin<Box<dyn Future<Output = Result<(), SendError<M>>> + Send + 'async_trait>>
where Self: Sync + 'async_trait,
'life0: 'async_trait { ... }
}Expand description
The transmit end of an M-typed channel.
Required Methods§
Sourcefn do_post(&self, message: M, return_channel: Option<Sender<SendError<M>>>)
fn do_post(&self, message: M, return_channel: Option<Sender<SendError<M>>>)
Post a message; returning failed deliveries on the return channel, if provided. If provided, the sender is dropped when the message has been enqueued at the channel endpoint.
Users should use the try_post, and post variants directly.
Sourcefn addr(&self) -> ChannelAddr
fn addr(&self) -> ChannelAddr
The channel address to which this Tx is sending.
Provided Methods§
Sourcefn try_post(&self, message: M, return_channel: Sender<SendError<M>>)
fn try_post(&self, message: M, return_channel: Sender<SendError<M>>)
Enqueue a message on the local end of the channel. The
message is either delivered, or we eventually discover that
the channel has failed and it will be sent back on return_channel.
Sourcefn send<'life0, 'async_trait>(
&'life0 self,
message: M,
) -> Pin<Box<dyn Future<Output = Result<(), SendError<M>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
fn send<'life0, 'async_trait>(
&'life0 self,
message: M,
) -> Pin<Box<dyn Future<Output = Result<(), SendError<M>>> + Send + 'async_trait>>where
Self: Sync + 'async_trait,
'life0: 'async_trait,
Send a message synchronously, returning when the messsage has been delivered to the remote end of the channel.