[−][src]Struct thruster::context::basic_context::BasicContext
Fields
params: HashMap<String, String>
query_params: HashMap<String, String>
request: Request
status: u32
headers: HashMap<String, String>
Methods
impl BasicContext
[src]
pub fn new() -> BasicContext
[src]
pub fn body(&mut self, body_string: &str)
[src]
Set the body as a string
pub fn get_body(&self) -> String
[src]
pub fn status(&mut self, code: u32)
[src]
Set the response status code
pub fn content_type(&mut self, c_type: &str)
[src]
Set the response Content-Type
. A shortcode for
ⓘThis example is not tested
ctx.set("Content-Type", "some-val");
pub fn redirect(&mut self, destination: &str)
[src]
Set up a redirect, will default to 302, but can be changed after the fact.
ⓘThis example is not tested
ctx.set("Location", "/some-path"); ctx.status(302);
pub fn cookie(&mut self, name: &str, value: &str, options: &CookieOptions)
[src]
Sets a cookie on the response
Trait Implementations
impl Context for BasicContext
[src]
type Response = Response
fn get_response(self) -> Self::Response
[src]
fn set_body(&mut self, body: Vec<u8>)
[src]
fn set_body_bytes(&mut self, body_bytes: Bytes)
[src]
fn route(&self) -> &str
[src]
fn set(&mut self, key: &str, value: &str)
[src]
fn remove(&mut self, key: &str)
[src]
impl Default for BasicContext
[src]
fn default() -> BasicContext
[src]
impl HasCookies for BasicContext
[src]
fn set_cookies(&mut self, cookies: Vec<Cookie>)
[src]
fn headers(&self) -> HashMap<String, String>
[src]
impl HasQueryParams for BasicContext
[src]
fn set_query_params(&mut self, query_params: HashMap<String, String>)
[src]
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
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,