pub struct Response<'a> { /* private fields */ }

Implementations

Remove a pair you have writed to a reponse header

  • The key is not case senstive
For example
add_header(String::from("a"),String::from("b"))

Header: {a:b}

remove_header(String::from("a"))

Header: {}

Add a pair to the header of the response

add_header(String::from("a"),String::from("b"))

Header:{a:b}

Check whether a pair exists in the header of a reponse

For example

assume the header is {a:b}

header_exist("a") returns true

The key is not case senstive

Get response header

  • Return a Vector since a single key can correspond to multiple values in the response header.

Write a utf-8 String to client

Write binary data to client

Only respond HTTP status to the client

Write file data to the client

Render a view to the client

  • factory implements Fn() -> tera::Result
  • The factory permits you customize the behavior of the tera engine

Only use the default configured tera to render a view to the client

  • path: path of view file
  • context: used in the view

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.

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.