pub fn into_0rtt(self) -> Result<(Connection, ZeroRttAccepted), Self> {
        let Self {
            connecting,
            settings,
        } = self;
        match connecting.into_0rtt() {
            Err(connecting) => Err(Self {
                connecting,
                settings,
            }),
            Ok((new_conn, zero_rtt)) => {
                let quinn::NewConnection {
                    connection,
                    uni_streams,
                    bi_streams,
                    ..
                } = new_conn;
                let conn_ref =
                    ConnectionRef::new(connection, Side::Client, uni_streams, bi_streams, settings);
                tokio::spawn(ConnectionDriver(conn_ref.clone()));
                Ok((Connection(conn_ref), zero_rtt))
            }
        }
    }
/// Try to convert an ongoing handshake into a 0-RTT enabled exchange
///
/// # About 0-RTT
///
/// 0 Round Trip Time is a QUIC feature enabling application data exchange before the
/// peers have finished the TLS handshake. It's based on prior crypto exchange, reused
/// for a new connection. So this function will fail if it's the first contact with
/// the server.
///
/// # Security concerns
///
/// This functionality is vulnerable to replay attacks. Therefore any request with a
/// non-idempotent method sent before [`ZeroRttAccepted`] resolves will fail.
///
/// # Usage
///
/// Upon success, this method returns a [`Connection`], and a `Future`
/// that will resolve when the handshake completes: [`ZeroRttAccepted`]. If this peer
/// is not associated with any known prior connection, the [`Connecting`] handshake
/// completion future will be handed back.
///
/// ## Task spawing
///
/// This method spawns two driver tasks for connection management at QUIC and HTTP/3
/// levels. Therefore, it must be called in tokio runtime context.
///
/// ## Example
/// ```
/// # use anyhow::Result;
/// use http::Request;
/// use quinn_h3::{
///     client::{Connecting, RecvResponse},
///     Body,
/// };
///
/// async fn send_0rtt_request(connecting: Connecting) -> Result<RecvResponse> {
///     let request = Request::get("https://example.com")
///         .body(Body::from(()))
///         .unwrap();
///
///     let mut connection = match connecting.into_0rtt() {
///         Ok((connection, _)) => connection,
///         Err(connecting) => connecting.await?,
///     };
///
///     let (send_response, recv_response) = connection.send_request(request);
///     send_response.await.unwrap();
///
///     Ok(recv_response)
/// }
/// ```
///
/// [`Connection`]: struct.Connection.html
/// [`ZeroRttAccepted`]: type.ZeroRttAccepted.html
/// [`Connecting`]: struct.Connecting.html
Try to convert an ongoing handshake into a 0-RTT enabled exchange
Try to convert an ongoing handshake into a 0 - RTT enabled exchange
pub fn into_0rtt(self) -> Result<(Connection, ZeroRttAccepted), Self> {
        let Self {
            connecting,
            settings,
        } = self;
        match connecting.into_0rtt() {
            Err(connecting) => Err(Self {
                connecting,
                settings,
            }),
            Ok((new_conn, zero_rtt)) => {
                let quinn::NewConnection {
                    connection,
                    uni_streams,
                    bi_streams,
                    ..
                } = new_conn;
                let conn_ref =
                    ConnectionRef::new(connection, Side::Client, uni_streams, bi_streams, settings);
                tokio::spawn(ConnectionDriver(conn_ref.clone()));
                Ok((Connection(conn_ref), zero_rtt))
            }
        }
    }
pub fn into_0rtt ( self ) -> Result < ( Connection , ZeroRttAccepted ) , Self > { let Self { connecting , settings , } = self ; match connecting . into_0rtt ( ) { Err ( connecting ) => Err ( Self { connecting , settings , } ) , Ok ( ( new_conn , zero_rtt ) ) => { let quinn :: NewConnection { connection , uni_streams , bi_streams , .. } = new_conn ; let conn_ref = ConnectionRef :: new ( connection , Side :: Client , uni_streams , bi_streams , settings ) ; tokio :: spawn ( ConnectionDriver ( conn_ref . clone ( ) ) ) ; Ok ( ( Connection ( conn_ref ) , zero_rtt ) ) } } }
Try to convert an ongoing handshake into a 0-RTT enabled exchange
Try to convert an ongoing handshake into a 0 - RTT enabled exchange
self
about 0-rtt
0 Round Trip Time is a QUIC feature enabling application data exchange before the
peers have finished the TLS handshake. It's based on prior crypto exchange, reused
for a new connection. So this function will fail if it's the first contact with
the server.
0 Round Trip Time is a QUIC feature enabling application data exchange before the peers have finished the TLS handshake . It ' s based on prior crypto exchange reused for a new connection . So this function will fail if it ' s the first contact with the server .
security concerns
This functionality is vulnerable to replay attacks. Therefore any request with a
non-idempotent method sent before [`ZeroRttAccepted`] resolves will fail.
This functionality is vulnerable to replay attacks . Therefore any request with a non - idempotent method sent before [ ` ZeroRttAccepted ` ] resolves will fail .
usage
Upon success, this method returns a [`Connection`], and a `Future`
that will resolve when the handshake completes: [`ZeroRttAccepted`]. If this peer
is not associated with any known prior connection, the [`Connecting`] handshake
completion future will be handed back.
Upon success this method returns a [ ` Connection ` ] and a ` Future ` that will resolve when the handshake completes : [ ` ZeroRttAccepted ` ] . If this peer is not associated with any known prior connection the [ ` Connecting ` ] handshake completion future will be handed back .
task spawing
This method spawns two driver tasks for connection management at QUIC and HTTP/3
levels. Therefore, it must be called in tokio runtime context.
This method spawns two driver tasks for connection management at QUIC and HTTP / 3 levels . Therefore it must be called in tokio runtime context .
example
None
use anyhow::result;
use http::Request;
use quinn_h3::{
client::{Connecting, RecvResponse},
Body,
}.



let mut connection = match connecting.into_0rtt() {
Ok((connection, _)) => connection,
Err(connecting) => connecting.await?,
}.

let (send_response, recv_response) = connection.send_request(request);
send_response.await.unwrap().

Ok(recv_response)
}
```

[`Connection`]: struct.Connection.html
[`ZeroRttAccepted`]: type.ZeroRttAccepted.html
[`Connecting`]: struct.Connecting.html
use http :: Request ; use quinn_h3 :: { client :: { Connecting RecvResponse } Body } . let mut connection = match connecting . into_0rtt () { Ok (( connection _ )) = > connection Err ( connecting ) = > connecting . await? } . let ( send_response recv_response ) = connection . send_request ( request ) ; send_response . await . unwrap () . Ok ( recv_response ) } ` ` ` [ ` Connection ` ] : struct . Connection . html [ ` ZeroRttAccepted ` ] : type . ZeroRttAccepted . html [ ` Connecting ` ] : struct . Connecting . html