[][src]Struct quinn::Connection

pub struct Connection(_);

A QUIC connection.

If all references to a connection (including every clone of the Connection handle, IncomingStreams, and the various stream types) other than the ConnectionDriver have been dropped, the the connection will be automatically closed with an error_code of 0 and an empty reason. You can also close the connection explicitly by calling Connection::close().

May be cloned to obtain another handle to the same connection.

Methods

impl Connection[src]

pub fn open_uni(&self) -> OpenUni[src]

Initiate a new outgoing unidirectional stream.

Streams are cheap and instantaneous to open unless blocked by flow control. As a consequence, the peer won't be notified that a stream has been opened until the stream is actually used.

pub fn open_bi(&self) -> OpenBi[src]

Initiate a new outgoing bidirectional stream.

Streams are cheap and instantaneous to open unless blocked by flow control. As a consequence, the peer won't be notified that a stream has been opened until the stream is actually used.

pub fn close(&self, error_code: VarInt, reason: &[u8])[src]

Close the connection immediately.

Pending operations will fail immediately with ConnectionError::LocallyClosed. Delivery of data on unfinished streams is not guaranteed, so the application must call this only when all important communications have been completed.

error_code and reason are not interpreted, and are provided directly to the peer.

reason will be truncated to fit in a single packet with overhead; to improve odds that it is preserved in full, it should be kept under 1KiB.

pub fn remote_address(&self) -> SocketAddr[src]

The peer's UDP address.

pub fn remote_id(&self) -> ConnectionId[src]

The ConnectionId defined for conn by the peer.

pub fn protocol(&self) -> Option<Box<[u8]>>[src]

The negotiated application protocol

pub fn set_logger(&self, log: Logger)[src]

Replace the diagnostic logger

Trait Implementations

impl Clone for Connection[src]

Auto Trait Implementations

Blanket Implementations

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> SendSyncUnwindSafe for T where
    T: Send + Sync + UnwindSafe + ?Sized
[src]

impl<V, T> VZip<V> for T where
    V: MultiLane<T>, 

impl<T> Erased for T