Skip to main content

QuicEndpoint

Trait QuicEndpoint 

Source
pub trait QuicEndpoint:
    Send
    + Sync
    + 'static {
    type Connection: QuicConnectionTrait;

    // Required methods
    fn accept(&self) -> impl Future<Output = Option<Self::Connection>> + Send;
    fn connect(
        &self,
        addr: SocketAddr,
        server_name: &str,
    ) -> impl Future<Output = Result<Self::Connection>> + Send;
}
Expand description

A bound QUIC endpoint that accepts and initiates connections.

Analogous to Server for TCP. QUIC library adapters implement this to provide the connection accept loop (server) and outbound connections (client).

The () implementation is a no-op (HTTP/3 disabled). Server-only implementations may return an error from connect; client-only implementations may return None from accept.

Required Associated Types§

Source

type Connection: QuicConnectionTrait

The connection type yielded by this endpoint.

Required Methods§

Source

fn accept(&self) -> impl Future<Output = Option<Self::Connection>> + Send

Accept the next inbound QUIC connection, or return None if the endpoint is done.

Source

fn connect( &self, addr: SocketAddr, server_name: &str, ) -> impl Future<Output = Result<Self::Connection>> + Send

Initiate a QUIC connection to the given address.

server_name is the SNI hostname used for TLS verification.

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 QuicEndpoint for ()

Source§

type Connection = NoQuic

Source§

async fn accept(&self) -> Option<NoQuic>

Source§

async fn connect(&self, _: SocketAddr, _: &str) -> Result<NoQuic>

Implementors§