pub struct Response { /* private fields */ }

Implementations§

Trait Implementations§

get_channels will create the channels for communicating between the chunk generator threads and the main stream. Listen to the receiver for any client communications, and use the sender to send any ensuing responses.

set_header is a sugar to the header API, and it’s created to simplify the majority of the use cases for setting the response header.

By default, the field-value pair will be set to the response header, and override any existing pairs if they’ve been set prior to the API call.

Examples

resp.set_header(“Content-Type”, “application/javascript”); assert!(resp.get_header(“Content-Type”).unwrap(), &String::from(“application/javascript”));

Send a static file as part of the response to the client. Return the http header status that can be set directly to the response object using:

resp.status(<returned_status_value_from_this_api>);

For example, if the file is read and parsed successfully, we will return 200; if we can’t find the file, we will return 404; if there are errors when reading the file from its location, we will return 500.

side effect: if the file is read and parsed successfully, we will set the content type based on file extension. You can always reset the value for this auto-generated content type response attribute. …

Can only redirect to internal path, no outsource path, sorry for the hackers (FYI, you can still hack the redirection link via Javascript)!

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.