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;
}
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<'async_trait>(
self,
value: T
) -> Pin<Box<dyn Future<Output = Result<(), ProvideError<TransportSinkError, TransportStreamError>>> + Send + 'async_trait>>where
Self: 'async_trait,
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.
sourcefn consume<'async_trait>(
self
) -> Pin<Box<dyn Future<Output = Result<T, ConsumeError<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,
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.