pub struct QuicConnection(/* private fields */);Expand description
A type-erased QUIC connection handle, equivalent to Arc<dyn QuicConnectionTrait>.
Cheaply cloneable.
Handlers retrieve this from conn state to access QUIC features (streams, datagrams) without depending on the concrete QUIC implementation type.
Implementations§
Source§impl QuicConnection
impl QuicConnection
Sourcepub async fn accept_bidi(
&self,
) -> Result<(u64, Box<dyn QuicTransportBidi + Unpin + Send + Sync>)>
pub async fn accept_bidi( &self, ) -> Result<(u64, Box<dyn QuicTransportBidi + Unpin + Send + Sync>)>
Accept the next bidirectional stream opened by the peer.
Sourcepub async fn accept_uni(
&self,
) -> Result<(u64, Box<dyn QuicTransportReceive + Unpin + Send + Sync>)>
pub async fn accept_uni( &self, ) -> Result<(u64, Box<dyn QuicTransportReceive + Unpin + Send + Sync>)>
Accept the next unidirectional stream opened by the peer.
Sourcepub async fn open_uni(
&self,
) -> Result<(u64, Box<dyn QuicTransportSend + Unpin + Send + Sync>)>
pub async fn open_uni( &self, ) -> Result<(u64, Box<dyn QuicTransportSend + Unpin + Send + Sync>)>
Open a new unidirectional stream to the peer.
Sourcepub async fn open_bidi(
&self,
) -> Result<(u64, Box<dyn QuicTransportBidi + Unpin + Send + Sync>)>
pub async fn open_bidi( &self, ) -> Result<(u64, Box<dyn QuicTransportBidi + Unpin + Send + Sync>)>
Open a new bidirectional stream to the peer.
Sourcepub fn remote_address(&self) -> SocketAddr
pub fn remote_address(&self) -> SocketAddr
The peer’s address.
Sourcepub fn close(&self, error_code: u64, reason: &[u8])
pub fn close(&self, error_code: u64, reason: &[u8])
Close the entire QUIC connection with an error code and reason.
Sourcepub fn send_datagram(&self, data: &[u8]) -> Result<()>
pub fn send_datagram(&self, data: &[u8]) -> Result<()>
Send an unreliable datagram over the QUIC connection.
Sourcepub async fn recv_datagram<'a, F: FnOnce(&[u8]) + Send + 'a>(
&'a self,
callback: F,
) -> Result<()>
pub async fn recv_datagram<'a, F: FnOnce(&[u8]) + Send + 'a>( &'a self, callback: F, ) -> Result<()>
Receive the next unreliable datagram from the peer, passing the raw bytes to callback.
Sourcepub fn max_datagram_size(&self) -> Option<usize>
pub fn max_datagram_size(&self) -> Option<usize>
The maximum datagram payload size the peer will accept, if datagrams are supported.
Trait Implementations§
Source§impl Clone for QuicConnection
impl Clone for QuicConnection
Source§fn clone(&self) -> QuicConnection
fn clone(&self) -> QuicConnection
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for QuicConnection
impl Debug for QuicConnection
Source§impl<T: QuicConnectionTrait> From<T> for QuicConnection
impl<T: QuicConnectionTrait> From<T> for QuicConnection
Auto Trait Implementations§
impl Freeze for QuicConnection
impl !RefUnwindSafe for QuicConnection
impl Send for QuicConnection
impl Sync for QuicConnection
impl Unpin for QuicConnection
impl UnsafeUnpin for QuicConnection
impl !UnwindSafe for QuicConnection
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more