Skip to main content

Connector

Trait Connector 

Source
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>> + Send;
    fn resolve(
        &self,
        host: &str,
        port: u16,
    ) -> impl Future<Output = Result<Vec<SocketAddr>>> + 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§

Source

type Transport: Transport

the Transport that connect returns

Source

type Runtime: RuntimeTrait

The RuntimeTrait for this Connector

Source

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§

Source

fn connect( &self, url: &Url, ) -> impl Future<Output = Result<Self::Transport>> + Send

Initiate a connection to the provided url

Source

fn resolve( &self, host: &str, port: u16, ) -> impl Future<Output = Result<Vec<SocketAddr>>> + Send

Perform a DNS lookup for a given host-and-port

Source

fn runtime(&self) -> Self::Runtime

Returns the runtime

Provided Methods§

Source

fn arced(self) -> ArcedConnector
where 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.

Implementors§