Trait TransportConnect

Source
pub trait TransportConnect:
    Sized
    + Send
    + Sync
    + 'static {
    // Required methods
    fn is_local(&self) -> bool;
    fn get_transport(
        &self,
    ) -> impl Send + Future<Output = Result<BoxTransport, TransportError>>;
}
Expand description

Connection details for a transport.

This object captures the information necessary to establish a transport, and may encapsulate reconnection logic.

§Why implement TransportConnect?

Users may want to implement transport-connect for the following reasons:

  • You want to customize a reqwest::Client before using it.
  • You need to provide special authentication information to a remote provider.
  • You have implemented a custom Transport.
  • You require a specific websocket reconnection strategy.

Required Methods§

Source

fn is_local(&self) -> bool

Returns true if the transport connects to a local resource.

Source

fn get_transport( &self, ) -> impl Send + Future<Output = Result<BoxTransport, TransportError>>

Connect to the transport, returning a Transport instance.

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§