Struct trillium_http::Upgrade[][src]

pub struct Upgrade<Transport> {
    pub request_headers: Headers,
    pub path: String,
    pub method: Method,
    pub state: Extensions,
    pub transport: Transport,
    pub buffer: Option<Vec<u8>>,
    pub stopper: Stopper,
}
Expand description

This open (pub fields) struct represents a http upgrade. It contains all of the data available on a Conn, as well as owning the underlying transport.

Important implementation note: When reading directly from the transport, ensure that you read from buffer first if there are bytes in it. Alternatively, read directly from the Upgrade, as that AsyncRead implementation will drain the buffer first before reading from the transport.

Fields

request_headers: Headers

The http request headers

path: String

The request path

method: Method

The http request method

state: Extensions

Any state that has been accumulated on the Conn before negotiating the upgrade

transport: Transport

The underlying io (often a TcpStream or similar)

buffer: Option<Vec<u8>>

Any bytes that have been read from the underlying tcpstream already. It is your responsibility to process these bytes before reading directly from the transport.

stopper: Stopper

A Stopper which can and should be used to gracefully shut down any long running streams or futures associated with this upgrade

Implementations

read-only access to the request headers

the http request path

the http method

any state that has been accumulated on the Conn before negotiating the upgrade.

Modify the transport type of this upgrade. This is useful for boxing the transport in order to erase the type argument.

Trait Implementations

Attempt to read from the AsyncRead into buf. Read more

Attempt to read from the AsyncRead into bufs using vectored IO operations. Read more

Attempt to write bytes from buf into the object. Read more

Attempt to flush the object, ensuring that any buffered data reach their destination. Read more

Attempt to close the object. Read more

Attempt to write bytes from bufs into the object using vectored IO operations. Read more

Formats the value using the given formatter. Read more

Performs the conversion.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Reads some bytes from the byte stream. Read more

Like read(), except it reads into a slice of buffers. Read more

Reads the entire contents and appends them to a Vec. Read more

Reads the entire contents and appends them to a String. Read more

Reads the exact number of bytes required to fill buf. Read more

Creates an adapter which will read at most limit bytes from it. Read more

Converts this [AsyncRead] into a [Stream] of bytes. Read more

Creates an adapter which will chain this stream with another. Read more

Boxes the reader and changes its type to dyn AsyncRead + Send + 'a. Read more

Writes some bytes into the byte stream. Read more

Like write(), except that it writes a slice of buffers. Read more

Writes an entire buffer into the byte stream. Read more

Flushes the stream to ensure that all buffered contents reach their destination. Read more

Closes the writer. Read more

Boxes the writer and changes its type to dyn AsyncWrite + Send + 'a. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

Performs the conversion.

in order to support downcasting from a Box<dyn Transport>, Transport requires implementing an as_box_any function. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.