Struct worker::Response[][src]

pub struct Response { /* fields omitted */ }
Expand description

A Response representation for working with or returning a response to a Request.

Implementations

Create a Response using B as the body encoded as JSON. Sets the associated Content-Type header for the Response as application/json.

Create a Response using the body encoded as HTML. Sets the associated Content-Type header for the Response as text/html.

Create a Response using unprocessed bytes provided. Sets the associated Content-Type header for the Response as application/octet-stream.

Create a Response using unprocessed text provided. Sets the associated Content-Type header for the Response as text/plain.

Create an empty Response with a 200 status code.

A helper method to send an error message to a client. Will return Err if the status code provided is outside the valid HTTP error range of 400-599.

Set the HTTP Status code on this Response.

Access this response’s body as plaintext.

Access this response’s body encoded as JSON.

Access this response’s body encoded as raw bytes.

Set this response’s Headers.

Read the Headers on this response.

Get a mutable reference to the Headers on this response.

Trait Implementations

Formats the value using the given formatter. Read more

Performs the conversion.

Performs the conversion.

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

Performs the conversion.

Performs the conversion.

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.