pub trait QuinnConn:
Clone
+ Send
+ Sync {
type AddrType: Debug;
type SockAddrType: Debug;
Show 14 methods
// Required methods
fn open_bi(&self) -> OpenBi<'_>;
fn accept_bi(&self) -> AcceptBi<'_>;
fn read_datagram(&self) -> ReadDatagram<'_>;
fn send_datagram(&self, data: Bytes) -> Result<(), SendDatagramError>;
fn send_datagram_wait(&self, data: Bytes) -> SendDatagram<'_>;
fn closed(&self) -> impl Future<Output = ConnectionError> + Send;
fn close_reason(&self) -> Option<ConnectionError>;
fn close(&self, error_code: VarInt, reason: &[u8]);
fn max_datagram_size(&self) -> Option<usize>;
fn datagram_send_buffer_space(&self) -> usize;
fn remote_address(&self) -> Self::SockAddrType;
fn local_ip(&self) -> Option<Self::AddrType>;
fn stable_id(&self) -> usize;
fn stats(&self) -> ConnectionStats;
}Expand description
Abstract over different types of Quinn-connections that differ only in the type of address that is used for the local and remote address.
Required Associated Types§
Sourcetype SockAddrType: Debug
type SockAddrType: Debug
The type used to represent the remote socket address.
Required Methods§
Sourcefn read_datagram(&self) -> ReadDatagram<'_>
fn read_datagram(&self) -> ReadDatagram<'_>
Reads a datagram, if one is available.
Sourcefn send_datagram(&self, data: Bytes) -> Result<(), SendDatagramError>
fn send_datagram(&self, data: Bytes) -> Result<(), SendDatagramError>
Sends a datagram.
Sourcefn send_datagram_wait(&self, data: Bytes) -> SendDatagram<'_>
fn send_datagram_wait(&self, data: Bytes) -> SendDatagram<'_>
Sends a datagram and wait for it to be sent.
Sourcefn closed(&self) -> impl Future<Output = ConnectionError> + Send
fn closed(&self) -> impl Future<Output = ConnectionError> + Send
Waits for the connection to be closed.
Sourcefn close_reason(&self) -> Option<ConnectionError>
fn close_reason(&self) -> Option<ConnectionError>
Returns the reason why the connection was closed, if it was closed.
Sourcefn close(&self, error_code: VarInt, reason: &[u8])
fn close(&self, error_code: VarInt, reason: &[u8])
Closes the connection with the given error code and reason.
Sourcefn max_datagram_size(&self) -> Option<usize>
fn max_datagram_size(&self) -> Option<usize>
Returns the maximum datagram size that can be sent on this connection.
Sourcefn datagram_send_buffer_space(&self) -> usize
fn datagram_send_buffer_space(&self) -> usize
Returns the amount of buffer space available for sending datagrams.
Sourcefn remote_address(&self) -> Self::SockAddrType
fn remote_address(&self) -> Self::SockAddrType
Returns the remote socket address type.
Sourcefn stats(&self) -> ConnectionStats
fn stats(&self) -> ConnectionStats
Returns connection statistics.
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.