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;
// Provided method
fn local_addr(&self) -> Result<SocketAddr> { ... }
}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.
Provided Methods§
Sourcefn local_addr(&self) -> Result<SocketAddr>
fn local_addr(&self) -> Result<SocketAddr>
The local address this endpoint is bound to. The default impl returns
Unsupported; adapters override when a bound UDP socket is available.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".