Struct thruster::context::basic_context::BasicContext [−][src]
pub struct BasicContext { pub cookies: Vec<Cookie>, pub params: Option<HashMap<String, String>>, pub query_params: Option<HashMap<String, String>>, pub request: Request, pub status: u32, pub headers: HashMap<String, String>, // some fields omitted }
Fields
params: Option<HashMap<String, String>>
query_params: Option<HashMap<String, String>>
request: Request
status: u32
headers: HashMap<String, String>
Implementations
Set Generic Serialize as body and sets header Content-Type to application/json
Set the response status code
Set the response Content-Type
. A shortcode for
ctx.set("Content-Type", "some-val");
Set up a redirect, will default to 302, but can be changed after the fact.
ctx.set("Location", "/some-path"); ctx.status(302);
Sets a cookie on the response
Trait Implementations
get_response returns a fully created response object based on the contents of the Context. This means setting the body according to whatever has been stored via set_body and/or set_body_bytes, as well as adding the proper headers that have been added via the set method. Read more
set_body is used to set the body using a vec of bytes on the context. The contents will be used later for generating the correct response. Read more
set_body_byte is used to set the body using a Bytes object on the context. The contents will be used later for generating the correct response. Read more
route is used to return the route from the incoming request as a string.
Returns the “default value” for a type. Read more
Auto Trait Implementations
impl RefUnwindSafe for BasicContext
impl Send for BasicContext
impl Sync for BasicContext
impl Unpin for BasicContext
impl UnwindSafe for BasicContext
Blanket Implementations
Mutably borrows from an owned value. Read more