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

Represents an HTTP response.

Implementations

Creates a new Response with the given head and body.

Creates a response builder.

Returns the associated status code.

Returns true if status code is StatusCode::OK.

Check if status is within 200-299.

Sets the status code for this response.

Returns the content type of this response.

Sets the Content-Type header on the response.

Returns a reference to the associated header map.

Returns a mutable reference to the associated header map.

Returns the string value of the specified header.

NOTE: Returns None if the header value is not a valid UTF8 string.

Returns the associated version.

Sets the version for this response.

Returns a reference to the associated extensions.

Returns a mutable reference to the associated extensions.

Get a reference from extensions, similar to self.extensions().get().

Inserts a value to extensions, similar to self.extensions().insert(data).

Sets the body for this response.

Take the body from this response and sets the body to empty.

Consume this response and return its inner body.

Consumes the response returning the head and body parts.

Trait Implementations

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Performs the conversion.

Consume itself and return Response.

Wrap an impl IntoResponse to add a header. Read more

Wrap an impl IntoResponse to with a new content type. Read more

Wrap an impl IntoResponse to set a status code. Read more

Wrap an impl IntoResponse to set a body. 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.

Attaches the provided Context to this type, returning a WithContext wrapper. Read more

Attaches the current Context to this type, returning a WithContext wrapper. Read more

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more

Instruments this type with the current Span, returning an Instrumented wrapper. Read more

Calls U::from(self).

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

Consumes this value returns a poem::Result<T>.

Should always be Self

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.

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more