Skip to main content

Tx

Trait Tx 

Source
pub trait Tx<M: RemoteMessage> {
    // Required methods
    fn do_post(&self, message: M, completion: CompletionSink<M>);
    fn addr(&self) -> ChannelAddr;
    fn status(&self) -> &Receiver<TxStatus>;

    // Provided methods
    fn try_post(&self, message: M) -> CompletionReceipt<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§

Source

fn do_post(&self, message: M, completion: CompletionSink<M>)

Post a message and report its terminal outcome to completion.

Users should use the try_post, and post variants directly.

Source

fn addr(&self) -> ChannelAddr

The channel address to which this Tx is sending.

Source

fn status(&self) -> &Receiver<TxStatus>

A means to monitor the health of a Tx.

Provided Methods§

Source

fn try_post(&self, message: M) -> CompletionReceipt<M> ⓘ

Enqueue a message on the local end of the channel and return a receipt that resolves when the message is accepted or rejected.

Source

fn post(&self, message: M)

Enqueue a message to be sent on the channel.

Source

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 message has been delivered to the remote end of the channel.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<M: RemoteMessage> Tx<M> for ChannelTx<M>

Source§

impl<M: RemoteMessage> Tx<M> for DuplexTx<M>