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§
Sourcetype Connection: QuicConnectionTrait
type Connection: QuicConnectionTrait
The connection type yielded by this endpoint.
Required Methods§
Sourcefn accept(&self) -> impl Future<Output = Option<Self::Connection>> + Send
fn accept(&self) -> impl Future<Output = Option<Self::Connection>> + Send
Accept the next inbound QUIC connection, or return None if the endpoint is done.
Sourcefn connect(
&self,
addr: SocketAddr,
server_name: &str,
) -> impl Future<Output = Result<Self::Connection>> + Send
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.