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

Wrapper over an HTTP Response.

The Response is created using a Version and a StatusCode. When creating a Response object, the body is initialized to None and the header is initialized with the default value. The body can be updated with a call to set_body. The header can be updated with set_content_type and set_server.

Implementations

Creates a new HTTP Response with an empty body.

Updates the body of the Response.

This function has side effects because it also updates the headers:

  • ContentLength: this is set to the length of the specified body.

Updates the content type of the Response.

Marks the Response as deprecated.

Updates the encoding type of Response.

Sets the HTTP response server.

Sets the HTTP allowed methods.

Allows a specific HTTP method.

Writes the content of the Response to the specified buf.

Errors

Returns an error when the buffer is not large enough.

Returns the Status Code of the Response.

Returns the Body of the response. If the response does not have a body, it returns None.

Returns the Content Length of the response.

Returns the Content Type of the response.

Returns the deprecation status of the response.

Returns the HTTP Version of the response.

Returns the allowed HTTP methods.

Trait Implementations

Formats the value using the given formatter. Read more

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason. Read more

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.