pub trait Connection:
Send
+ Sync
+ 'static {
type SendStream: SendStream;
type RecvStream: RecvStream;
type OpenError: Error + Send + Sync + 'static;
type AcceptError: Error + Send + Sync + 'static;
// Required methods
fn open_bi(
&self,
) -> impl Future<Output = Result<(Self::SendStream, Self::RecvStream), Self::OpenError>> + Send;
fn accept_bi(
&self,
) -> impl Future<Output = Result<Option<(Self::SendStream, Self::RecvStream)>, Self::AcceptError>> + Send;
fn close(&self, code: u32, reason: &[u8]);
fn is_open(&self) -> bool;
}Expand description
Abstraction over a QUIC connection.
This trait provides the minimal interface needed by quic-reverse to open and accept bidirectional streams.
Required Associated Types§
Sourcetype SendStream: SendStream
type SendStream: SendStream
The send stream type produced by this connection.
Sourcetype RecvStream: RecvStream
type RecvStream: RecvStream
The receive stream type produced by this connection.
Sourcetype AcceptError: Error + Send + Sync + 'static
type AcceptError: Error + Send + Sync + 'static
Error type for accepting streams.
Required Methods§
Sourcefn open_bi(
&self,
) -> impl Future<Output = Result<(Self::SendStream, Self::RecvStream), Self::OpenError>> + Send
fn open_bi( &self, ) -> impl Future<Output = Result<(Self::SendStream, Self::RecvStream), Self::OpenError>> + Send
Opens a new bidirectional stream.
Returns a future that resolves to a send/receive stream pair.
Sourcefn accept_bi(
&self,
) -> impl Future<Output = Result<Option<(Self::SendStream, Self::RecvStream)>, Self::AcceptError>> + Send
fn accept_bi( &self, ) -> impl Future<Output = Result<Option<(Self::SendStream, Self::RecvStream)>, Self::AcceptError>> + Send
Accepts an incoming bidirectional stream.
Returns a future that resolves to a send/receive stream pair,
or None if the connection is closing.
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.