Struct highnoon::Response

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

A response to be returned to the client. You do not always need to use this struct directly as endpoints can return anything implementing Responder. However this is the most flexible way to construct a reply, and it implements Responder (the “identity” implementation).

Implementations

Create an empty response with status code OK (200)

Create an empty response with the given status code

Set the status code of a response

Get the status code of a response

Set the body of the response

Set the body to an AsyncRead object

Set the body to the content of a file given by a Path Also sets a content type by guessing the mime type from the path name

Set the body of the response to a JSON payload

Set the body of the response to form data

Set a header (from the headers crate)

Set a header (without consuming self - useful outside of method chains)

Set a raw header (from the http crate)

Set a raw header (without consuming self)

Consume this response and return the inner hyper::Response

Trait Implementations

Get a reference to the inner hyper::Response

Converts this type into a shared reference of the (usually inferred) input type.
Formats the value using the given formatter. Read more

Create a Response from a hyper::Response<hyper::Body>

Converts to this type from the input type.

Identity implementation

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.

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.

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