pub trait Connector:
Send
+ Sync
+ 'static {
type Transport: Transport;
type Runtime: RuntimeTrait;
type Udp: UdpTransport;
// Required methods
fn connect(
&self,
url: &Url,
) -> impl Future<Output = Result<Self::Transport, Error>> + Send;
fn resolve(
&self,
host: &str,
port: u16,
) -> impl Future<Output = Result<Vec<SocketAddr>, Error>> + Send;
fn runtime(&self) -> Self::Runtime;
// Provided method
fn arced(self) -> ArcedConnector
where Self: Sized { ... }
}Expand description
Interface for runtime and tls adapters for the trillium client
See
trillium_client for more
information on usage.
Required Associated Types§
Sourcetype Runtime: RuntimeTrait
type Runtime: RuntimeTrait
The RuntimeTrait for this Connector
Sourcetype Udp: UdpTransport
type Udp: UdpTransport
The async UDP socket type for this connector. Used by QUIC adapters
for HTTP/3 support. Connectors that do not support UDP should set
this to ().
Required Methods§
Sourcefn connect(
&self,
url: &Url,
) -> impl Future<Output = Result<Self::Transport, Error>> + Send
fn connect( &self, url: &Url, ) -> impl Future<Output = Result<Self::Transport, Error>> + Send
Initiate a connection to the provided url
Provided Methods§
Sourcefn arced(self) -> ArcedConnectorwhere
Self: Sized,
fn arced(self) -> ArcedConnectorwhere
Self: Sized,
Returns an object-safe ArcedConnector. Do not implement this.
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 Connector for ClientConfig
impl Connector for ClientConfig
type Runtime = SmolRuntime
type Transport = SmolTransport<TcpStream>
type Udp = SmolUdpSocket
fn runtime(&self) -> <ClientConfig as Connector>::Runtime
async fn connect( &self, url: &Url, ) -> Result<<ClientConfig as Connector>::Transport, Error>
async fn resolve(&self, host: &str, port: u16) -> Result<Vec<SocketAddr>, Error>
Source§impl Connector for SmolTransport<UnixStream>
Available on Unix only.
impl Connector for SmolTransport<UnixStream>
Available on Unix only.