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;
}
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§
Sourcefn provide(
self,
value: T,
) -> impl Future<Output = Result<(), ProvideError<TransportSinkError, TransportStreamError>>> + Send
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.
Sourcefn consume(
self,
) -> impl Future<Output = Result<T, ConsumeError<TransportSinkError, TransportStreamError>>> + Send
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.