[−][src]Struct quinn::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]
fn clone(&self) -> Connection
[src]
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Auto Trait Implementations
impl Unpin for Connection
impl Sync for Connection
impl Send for Connection
impl UnwindSafe for Connection
impl RefUnwindSafe for Connection
Blanket Implementations
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
fn to_owned(&self) -> T
[src]
fn clone_into(&self, target: &mut T)
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> From<T> for T
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> SendSyncUnwindSafe for T where
T: Send + Sync + UnwindSafe + ?Sized,
[src]
T: Send + Sync + UnwindSafe + ?Sized,
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,