pub trait Transport: Send + Sync {
// Required method
fn dial<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
options: DialOptions,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Conn>, Error>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
}Expand description
Dials the network connection a client talks over. It is the seam where a network handler
plugs in: the built-in WebSocketTransport speaks RFC 6455 over tokio-tungstenite, and
wrapping another WebSocket crate, or an in-memory pipe for tests, means implementing
this and Conn and nothing else.
Required Methods§
Sourcefn dial<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
options: DialOptions,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Conn>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn dial<'life0, 'life1, 'async_trait>(
&'life0 self,
url: &'life1 str,
options: DialOptions,
) -> Pin<Box<dyn Future<Output = Result<Box<dyn Conn>, Error>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Opens one connection. options carries the subprotocols the client’s protocols
negotiate under and the headers that authorize the request.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".
Implementations on Foreign Types§
Source§impl<T: Transport + ?Sized> Transport for Arc<T>
A shared transport dials like the one it shares, so an application can keep one and hand
it to every client it builds.
impl<T: Transport + ?Sized> Transport for Arc<T>
A shared transport dials like the one it shares, so an application can keep one and hand it to every client it builds.