Trait Connection
pub trait Connection:
Clone
+ Debug
+ ExtensionsRef
+ Send
+ Sync
+ 'static {
type SendStream: SendStream;
type RecvStream: RecvStream;
type CloseLease: Send + Sync + Unpin + 'static;
Show 24 methods
// Required methods
fn open_bi(
&self,
) -> impl Future<Output = Result<(Self::SendStream, Self::RecvStream), ConnectionError>> + Send;
fn open_uni(
&self,
) -> impl Future<Output = Result<Self::SendStream, ConnectionError>> + Send;
fn accept_bi(
&self,
) -> impl Future<Output = Result<(Self::SendStream, Self::RecvStream), ConnectionError>> + Send;
fn accept_uni(
&self,
) -> impl Future<Output = Result<Self::RecvStream, ConnectionError>> + Send;
fn side(&self) -> Side;
fn handshake_confirmed(
&self,
) -> impl Future<Output = Result<(), ConnectionError>> + Send;
fn is_handshake_confirmed(&self) -> bool;
fn close(&self, error_code: VarInt, reason: &[u8]);
fn closed(&self) -> impl Future<Output = ConnectionError> + Send;
fn close_reason(&self) -> Option<ConnectionError>;
fn available_streams(&self, dir: Dir) -> u64;
fn max_concurrent_streams(&self, dir: Dir) -> u64;
fn remote_stream_limit(&self, dir: Dir) -> u64;
fn local_stream_limit(&self, dir: Dir) -> u64;
fn early_data(&self) -> EarlyData;
fn early_data_context_matches(&self, context: &[u8]) -> bool;
fn qlog_control(&self) -> Option<ConnectionQlogControl>;
fn read_datagram(
&self,
) -> impl Future<Output = Result<Bytes, ConnectionError>> + Send;
fn max_datagram_size(&self) -> Option<usize>;
fn datagram_receive_enabled(&self) -> bool;
fn received_datagrams(&self) -> usize;
fn datagram_send_ready(
&self,
) -> impl Future<Output = ()> + Send + 'static + use<Self>;
fn close_lease(&self) -> Self::CloseLease;
fn rtt(&self) -> Duration;
}http-backend and http and quic and std only.Expand description
A QUIC connection carrying HTTP/3.
Clones share one connection and its live extensions. h3 races opens and accepts in
select!, so dropping a pending one must not lose stream credit or an incoming stream.
Required Associated Types§
type SendStream: SendStream
type RecvStream: RecvStream
type CloseLease: Send + Sync + Unpin + 'static
Required Methods§
fn open_bi( &self, ) -> impl Future<Output = Result<(Self::SendStream, Self::RecvStream), ConnectionError>> + Send
fn open_uni( &self, ) -> impl Future<Output = Result<Self::SendStream, ConnectionError>> + Send
fn accept_bi(
&self,
) -> impl Future<Output = Result<(Self::SendStream, Self::RecvStream), ConnectionError>> + Send
fn accept_bi( &self, ) -> impl Future<Output = Result<(Self::SendStream, Self::RecvStream), ConnectionError>> + Send
Accept the next peer-initiated bidirectional stream. Queued incoming streams remain available after connection closure, before the terminal error.
fn accept_uni(
&self,
) -> impl Future<Output = Result<Self::RecvStream, ConnectionError>> + Send
fn accept_uni( &self, ) -> impl Future<Output = Result<Self::RecvStream, ConnectionError>> + Send
Accept the next peer-initiated unidirectional stream. Queued incoming streams remain available after connection closure, before the terminal error, so HTTP/3 can drain buffered control and QPACK data.
fn side(&self) -> Side
fn side(&self) -> Side
Which stream IDs are locally initiated. Must match the IDs the streams report.
fn handshake_confirmed(
&self,
) -> impl Future<Output = Result<(), ConnectionError>> + Send
fn handshake_confirmed( &self, ) -> impl Future<Output = Result<(), ConnectionError>> + Send
Application data can be sent without 0-RTT replay risk.
Before resolving successfully, publish the negotiated
Config::application_protocol in
NegotiatedTlsParameters in the shared extensions.
fn is_handshake_confirmed(&self) -> bool
fn is_handshake_confirmed(&self) -> bool
Whether Self::handshake_confirmed resolved successfully; stays true after closing.
fn close(&self, error_code: VarInt, reason: &[u8])
fn closed(&self) -> impl Future<Output = ConnectionError> + Send
fn close_reason(&self) -> Option<ConnectionError>
fn available_streams(&self, dir: Dir) -> u64
fn available_streams(&self, dir: Dir) -> u64
Locally initiated streams that can be opened now.
fn max_concurrent_streams(&self, dir: Dir) -> u64
fn max_concurrent_streams(&self, dir: Dir) -> u64
Streams this endpoint allows the peer to have open at once.
fn remote_stream_limit(&self, dir: Dir) -> u64
fn remote_stream_limit(&self, dir: Dir) -> u64
Cumulative count of streams this endpoint allows the peer to open.
fn local_stream_limit(&self, dir: Dir) -> u64
fn local_stream_limit(&self, dir: Dir) -> u64
Cumulative count of streams the peer allows this endpoint to open.
fn early_data(&self) -> EarlyData
fn early_data(&self) -> EarlyData
Where this client’s early data stands.
fn early_data_context_matches(&self, context: &[u8]) -> bool
fn early_data_context_matches(&self, context: &[u8]) -> bool
Whether server TLS acceptance is bound to this application’s encoded compatibility context. Return false when no context was configured. This is not evidence that any particular request arrived early.
fn qlog_control(&self) -> Option<ConnectionQlogControl>
fn qlog_control(&self) -> Option<ConnectionQlogControl>
The qlog sink HTTP/3 events are written to.
fn read_datagram(
&self,
) -> impl Future<Output = Result<Bytes, ConnectionError>> + Send
fn read_datagram( &self, ) -> impl Future<Output = Result<Bytes, ConnectionError>> + Send
Receive the next QUIC DATAGRAM payload. Dropping a pending future must not discard a datagram; HTTP/3 selects this future alongside other connection work.
fn max_datagram_size(&self) -> Option<usize>
fn datagram_receive_enabled(&self) -> bool
fn datagram_receive_enabled(&self) -> bool
The peer may send QUIC DATAGRAM frames to this endpoint.
fn received_datagrams(&self) -> usize
fn received_datagrams(&self) -> usize
Datagrams received and not yet taken by Self::read_datagram.
fn datagram_send_ready(
&self,
) -> impl Future<Output = ()> + Send + 'static + use<Self>
fn datagram_send_ready( &self, ) -> impl Future<Output = ()> + Send + 'static + use<Self>
Room on the datagram send queue, or the connection closed. Registered when called: create it before a send that may be refused as blocked and await it after the refusal.
fn close_lease(&self) -> Self::CloseLease
fn close_lease(&self) -> Self::CloseLease
Holds off this connection’s close at a graceful shutdown until dropped, so a tunnel can still send what it carries.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".