ConnectExt

Trait ConnectExt 

Source
pub trait ConnectExt<T, TransportSinkError, TransportStreamError> {
    // Required methods
    fn provide(
        self,
        value: T,
    ) -> impl Future<Output = Result<(), ProvideError<TransportSinkError, TransportStreamError>>> + Send;
    fn consume(
        self,
    ) -> impl Future<Output = Result<T, ConsumeError<TransportSinkError, TransportStreamError>>> + Send;
}
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( self, value: T, ) -> impl Future<Output = Result<(), ProvideError<TransportSinkError, TransportStreamError>>> + Send

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( self, ) -> impl Future<Output = Result<T, ConsumeError<TransportSinkError, TransportStreamError>>> + Send

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.

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§

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,