[][src]Struct quiche::h3::Connection

pub struct Connection { /* fields omitted */ }

An HTTP/3 connection.

Methods

impl Connection[src]

pub fn with_transport(
    conn: &mut Connection,
    config: &Config
) -> Result<Connection>
[src]

Creates a new HTTP/3 connection using the provided QUIC connection.

This will also initiate the HTTP/3 handshake with the peer by opening all control streams (including QPACK) and sending the local settings.

pub fn send_request(
    &mut self,
    conn: &mut Connection,
    headers: &[Header],
    fin: bool
) -> Result<u64>
[src]

Sends an HTTP/3 request.

The request is encoded from the provided list of headers, 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_response(
    &mut self,
    conn: &mut Connection,
    stream_id: u64,
    headers: &[Header],
    fin: bool
) -> Result<()>
[src]

Sends an HTTP/3 response on the specified stream.

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_body(
    &mut self,
    conn: &mut Connection,
    stream_id: u64,
    body: &[u8],
    fin: bool
) -> Result<usize>
[src]

Sends an HTTP/3 body chunk on the given stream.

On success the number of bytes written is returned, or Done if no bytes could be written (e.g. because the stream is blocked).

Note that the number of written bytes returned can be lower than the length of the input buffer when the underlying QUIC stream doesn't have enough capacity for the operation to complete.

When a partial write happens (including when Done is returned) the application should retry the operation once the stream is reported as writable again.

pub fn recv_body(
    &mut self,
    conn: &mut Connection,
    stream_id: u64,
    out: &mut [u8]
) -> Result<usize>
[src]

Reads request or response body data into the provided buffer.

Applications should call this method whenever the poll() method returns a Data event.

On success the amount of bytes read is returned, or Done if there is no data to read.

pub fn poll(&mut self, conn: &mut Connection) -> Result<(u64, Event)>[src]

Processes HTTP/3 data received from the peer.

On success it returns an Event as well as the event's source stream ID. The stream ID can be used when calling send_response() and send_body() when responding to incoming requests. On error the connection will be closed by calling close() with the appropriate error code.

Auto Trait Implementations

impl RefUnwindSafe for Connection

impl Send for Connection

impl Sync for Connection

impl Unpin for Connection

impl UnwindSafe for Connection

Blanket Implementations

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

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

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

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

impl<T, U> Into<U> for T where
    U: From<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.