Trait trillium_server_common::Connector [−][src]
pub trait Connector: 'static + Clone + Send + Sync { type Transport: 'static + AsyncRead + AsyncWrite + Unpin + Send + Sync; type Config: Debug + Default + Send + Sync + Clone; fn peer_addr(transport: &Self::Transport) -> Result<SocketAddr, Error>; #[must_use] fn connect<'life0, 'life1, 'async_trait>(
url: &'life0 Url,
config: &'life1 Self::Config
) -> Pin<Box<dyn Future<Output = Result<Self::Transport, Error>> + 'async_trait + Send, Global>>
where
'life0: 'async_trait,
'life1: 'async_trait,
Self: 'async_trait; fn spawn<Fut>(future: Fut)
where
Fut: Future + Send + 'static,
<Fut as Future>::Output: Send; }
Expand description
Interface for runtime and tls adapters for the trillium client
See
trillium_client
for more
information on usage.
Associated Types
The async read + write type for this connector, often a TcpStream or TlSStream
Required methods
A SocketAddr representation of the other side of this connection
Initiate a connection to the provided url, using the configuration.
Async trait signature:
ⓘ
async fn connect(url: &Url, config: &Self::Config) -> std::io::Result<Self::Transport>;
Spawn and detach a task on the runtime. Although this may seem unrelated to the purpose of a tcp connector, it is required as a workaround for the absence of async drop in order to enable keepalive connection pooling. TLS implementations that wrap a runtime implementation should call through to the inner spawn.