pub struct UnitResponse<'a> { /* private fields */ }
Expand description

An object used to send follow-up response bytes to a request, obtained by calling a UnitRequest’s create_response() method. Dropping this object will end the response.

Implementations

Send another chunk of bytes for this request’s response. The bytes will be immediately sent to the client.

This method allocates a buffer in Unit’s shared memory region, and calls a user function to fill it.

The user function receives a &mut &mut [u8] slice, and the write! macro can be used to advance the start position of the slice. Only the bytes between the original start and the new start positions will be sent, and the rest will be discarded.

Methods from Deref<Target = UnitRequest<'a>>

Copy bytes from the request body into the target buffer and return the number of bytes written.

If the buffer is smaller than the contents of the body, the contents will be truncated to the size of the buffer.

Create an interator over all header (name, value) tuples.

Return the method of the request (e.g. “GET”).

Return the protocol version of the request (e.g. “HTTP/1.1”).

Return the remote IP address of the client.

Return the local IP address of the server.

Return the host name of the server.

Return the combined URI path and query string.

Return the URI path.

Return the URI query string.

Trait Implementations

The resulting type after dereferencing.

Dereferences the value.

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

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.