CommunicationChannel

Trait CommunicationChannel 

Source
pub trait CommunicationChannel: Send + 'static {
    type Error: CommunicationError;

    // Required methods
    fn send(
        &mut self,
        message: Message,
    ) -> impl Future<Output = Result<(), Self::Error>> + Send;
    fn recv(
        &mut self,
    ) -> impl Future<Output = Result<Option<Message>, Self::Error>> + Send;
    fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send;
}
Expand description

Handles communications.

Required Associated Types§

Required Methods§

Source

fn send( &mut self, message: Message, ) -> impl Future<Output = Result<(), Self::Error>> + Send

Send a message on the channel.

Source

fn recv( &mut self, ) -> impl Future<Output = Result<Option<Message>, Self::Error>> + Send

Receive a message on the channel and returns a new response message.

Source

fn close(&mut self) -> impl Future<Output = Result<(), Self::Error>> + Send

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§