pub fn send_request<T: NameValue>(
        &mut self, conn: &mut super::Connection, headers: &[T], fin: bool,
    ) -> Result<u64> {
        // If we received a GOAWAY from the peer, MUST NOT initiate new
        // requests.
        if self.peer_goaway_id.is_some() {
            return Err(Error::FrameUnexpected);
        }

        let stream_id = self.next_request_stream_id;

        self.streams
            .insert(stream_id, stream::Stream::new(stream_id, true));

        // The underlying QUIC stream does not exist yet, so calls to e.g.
        // stream_capacity() will fail. By writing a 0-length buffer, we force
        // the creation of the QUIC stream state, without actually writing
        // anything.
        if let Err(e) = conn.stream_send(stream_id, b"", false) {
            self.streams.remove(&stream_id);

            if e == super::Error::Done {
                return Err(Error::StreamBlocked);
            }

            return Err(e.into());
        };

        self.send_headers(conn, stream_id, headers, fin)?;

        // To avoid skipping stream IDs, we only calculate the next available
        // stream ID when a request has been successfully buffered.
        self.next_request_stream_id = self
            .next_request_stream_id
            .checked_add(4)
            .ok_or(Error::IdError)?;

        Ok(stream_id)
    }
/// Sends an HTTP/3 request.
///
/// The request is encoded from the provided list of headers without a
/// body, and sent on a newly allocated stream. To include a body,
/// set `fin` as `false` and subsequently call [`send_body()`] with the
/// same `conn` and the `stream_id` returned from this method.
///
/// On success the newly allocated stream ID is returned.
///
/// The [`StreamBlocked`] error is returned when the underlying QUIC stream
/// doesn't have enough capacity for the operation to complete. When this
/// happens the application should retry the operation once the stream is
/// reported as writable again.
///
/// [`send_body()`]: struct.Connection.html#method.send_body
/// [`StreamBlocked`]: enum.Error.html#variant.StreamBlocked
Sends an HTTP/3 request.
The request is encoded from the provided list of headers without a
body, and sent on a newly allocated stream.

On success the newly allocated stream ID is returned.

The [`StreamBlocked`] error is returned when the underlying QUIC stream
doesn't have enough capacity for the operation to complete. When this
happens the application should retry the operation once the stream is
reported as writable again.


Sends an HTTP / 3 request . The request is encoded from the provided list of headers without a body and sent on a newly allocated stream . On success the newly allocated stream ID is returned . The [ ` StreamBlocked ` ] error is returned when the underlying QUIC stream doesn ' t have enough capacity for the operation to complete . When this happens the application should retry the operation once the stream is reported as writable again .
pub fn send_request<T: NameValue>(
        &mut self, conn: &mut super::Connection, headers: &[T], fin: bool,
    ) -> Result<u64> {
        // If we received a GOAWAY from the peer, MUST NOT initiate new
        // requests.
        if self.peer_goaway_id.is_some() {
            return Err(Error::FrameUnexpected);
        }
        let stream_id = self.next_request_stream_id;
        self.streams
            .insert(stream_id, stream::Stream::new(stream_id, true));
        // The underlying QUIC stream does not exist yet, so calls to e.g.
        // stream_capacity() will fail. By writing a 0-length buffer, we force
        // the creation of the QUIC stream state, without actually writing
        // anything.
        if let Err(e) = conn.stream_send(stream_id, b"", false) {
            self.streams.remove(&stream_id);
            if e == super::Error::Done {
                return Err(Error::StreamBlocked);
            }
            return Err(e.into());
        };
        self.send_headers(conn, stream_id, headers, fin)?;
        // To avoid skipping stream IDs, we only calculate the next available
        // stream ID when a request has been successfully buffered.
        self.next_request_stream_id = self
            .next_request_stream_id
            .checked_add(4)
            .ok_or(Error::IdError)?;
        Ok(stream_id)
    }
pub fn send_request < T : NameValue > ( & mut self , conn : & mut super :: Connection , headers : & [ T ] , fin : bool , ) -> Result < u64 > { // If we received a GOAWAY from the peer, MUST NOT initiate new // requests. if self . peer_goaway_id . is_some ( ) { return Err ( Error :: FrameUnexpected ) ; } let stream_id = self . next_request_stream_id ; self . streams . insert ( stream_id , stream :: Stream :: new ( stream_id , true ) ) ; // The underlying QUIC stream does not exist yet, so calls to e.g. // stream_capacity() will fail. By writing a 0-length buffer, we force // the creation of the QUIC stream state, without actually writing // anything. if let Err ( e ) = conn . stream_send ( stream_id , b" " , false ) { self . streams . remove ( & stream_id ) ; if e == super :: Error :: Done { return Err ( Error :: StreamBlocked ) ; } return Err ( e . into ( ) ) ; } ; self . send_headers ( conn , stream_id , headers , fin ) ? ; // To avoid skipping stream IDs, we only calculate the next available // stream ID when a request has been successfully buffered. self . next_request_stream_id = self . next_request_stream_id . checked_add ( 4 ) . ok_or ( Error :: IdError ) ? ; Ok ( stream_id ) }
Sends an HTTP/3 request.
Sends an HTTP / 3 request .
&mut self
conn
&mut super::Connection
headers
&[T]
fin
bool
&mut self
conn
&mut super::Connection
headers
&[T]
fin
bool