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.

Implementations on Foreign Types§

Source§

impl<'a, T: 'a + TransportConnect + ?Sized> TransportConnect for &'a T
where &'a T: Sized + Send + Sync + 'static,

Source§

impl<'a, T: 'a + TransportConnect + ?Sized> TransportConnect for &'a mut T
where &'a mut T: Sized + Send + Sync + 'static,

Source§

impl<T: TransportConnect + ?Sized> TransportConnect for Box<T>
where Box<T>: Sized + Send + Sync + 'static,

Source§

impl<T: TransportConnect + ?Sized> TransportConnect for Arc<T>
where Arc<T>: Sized + Send + Sync + 'static,

Implementors§