pub struct Connection { /* private fields */ }Expand description
A wrapper around an iroh::endpoint::Connection that implements the
h3::quic::Connection trait for use in HTTP/3 over QUIC.
This struct manages incoming and outgoing unidirectional and bidirectional
streams and handles conversions between iroh and h3 errors.
Implementations§
Source§impl Connection
impl Connection
Sourcepub fn new(conn: Connection) -> Self
pub fn new(conn: Connection) -> Self
Creates a new Connection from an existing iroh::endpoint::Connection.
This sets up async streams for accepting incoming unidirectional and bidirectional QUIC streams.
§Arguments
conn- The underlyingirohconnection to wrap.
Trait Implementations§
Source§impl<B> Connection<B> for Connectionwhere
B: Buf,
impl<B> Connection<B> for Connectionwhere
B: Buf,
Source§fn poll_accept_bidi(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Self::BidiStream, ConnectionErrorIncoming>>
fn poll_accept_bidi( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Self::BidiStream, ConnectionErrorIncoming>>
Polls for an incoming bidirectional stream (accepts a stream).
Returns a pair of SendStream and RecvStream wrapped in
BidiStream.
Source§fn poll_accept_recv(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Self::RecvStream, ConnectionErrorIncoming>>
fn poll_accept_recv( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Self::RecvStream, ConnectionErrorIncoming>>
Polls for an incoming unidirectional receive stream.
Returns a RecvStream once available.
Source§fn opener(&self) -> Self::OpenStreams
fn opener(&self) -> Self::OpenStreams
Returns a new OpenStreams handle for opening outgoing streams.
Source§type RecvStream = RecvStream
type RecvStream = RecvStream
poll_accept_recv()Source§type OpenStreams = OpenStreams
type OpenStreams = OpenStreams
Source§impl<B> OpenStreams<B> for Connectionwhere
B: Buf,
impl<B> OpenStreams<B> for Connectionwhere
B: Buf,
Source§fn poll_open_bidi(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Self::BidiStream, StreamErrorIncoming>>
fn poll_open_bidi( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Self::BidiStream, StreamErrorIncoming>>
Attempts to open a new bidirectional stream for sending and receiving.
Returns a BidiStream once ready, or a StreamErrorIncoming on failure.
Source§fn poll_open_send(
&mut self,
cx: &mut Context<'_>,
) -> Poll<Result<Self::SendStream, StreamErrorIncoming>>
fn poll_open_send( &mut self, cx: &mut Context<'_>, ) -> Poll<Result<Self::SendStream, StreamErrorIncoming>>
Attempts to open a new unidirectional send stream.
Returns a SendStream once ready.
Source§fn close(&mut self, code: Code, reason: &[u8])
fn close(&mut self, code: Code, reason: &[u8])
Closes the QUIC connection with the provided application error code and reason.
Source§type SendStream = SendStream<B>
type SendStream = SendStream<B>
poll_open_send()Source§type BidiStream = BidiStream<B>
type BidiStream = BidiStream<B>
poll_open_bidi()