Trait remoc::ConnectExt

source ·
pub trait ConnectExt<T, TransportSinkError, TransportStreamError> {
    // Required methods
    fn provide<'async_trait>(
        self,
        value: T
    ) -> Pin<Box<dyn Future<Output = Result<(), ProvideError<TransportSinkError, TransportStreamError>>> + Send + 'async_trait>>
       where Self: 'async_trait;
    fn consume<'async_trait>(
        self
    ) -> Pin<Box<dyn Future<Output = Result<T, ConsumeError<TransportSinkError, TransportStreamError>>> + Send + 'async_trait>>
       where Self: 'async_trait;
}
Available on crate feature rch only.
Expand description

Convenience methods for connection handling.

This trait is implemented for the return value of any Connect method using the default codec and a transport with 'static lifetime.

Required Methods§

source

fn provide<'async_trait>( self, value: T ) -> Pin<Box<dyn Future<Output = Result<(), ProvideError<TransportSinkError, TransportStreamError>>> + Send + 'async_trait>>
where Self: 'async_trait,

Establishes the connection and provides a single value to the remote endpoint.

The value is sent over the base channel and then the base channel is closed. The connection dispatcher is spawned onto a new task and a warning message is logged if the connection fails.

This is intended to be used with the consume method on the remote endpoint.

source

fn consume<'async_trait>( self ) -> Pin<Box<dyn Future<Output = Result<T, ConsumeError<TransportSinkError, TransportStreamError>>> + Send + 'async_trait>>
where Self: 'async_trait,

Establishes the connection and consumes a single value from the remote endpoint.

The value is received over the base channel and then the base channel is closed. The connection dispatcher is spawned onto a new task and a warning message is logged if the connection fails.

This is intended to be used with the provide method on the remote endpoint.

Implementors§

source§

impl<TransportSinkError, TransportStreamError, T, ConnectFuture> ConnectExt<T, TransportSinkError, TransportStreamError> for ConnectFuture
where T: RemoteSend, TransportSinkError: Send + Error + 'static, TransportStreamError: Send + Error + 'static, ConnectFuture: Future<Output = Result<(Connect<'static, TransportSinkError, TransportStreamError>, Sender<T, Default>, Receiver<T, Default>), ConnectError<TransportSinkError, TransportStreamError>>> + Send,