[][src]Struct thruster::BasicHyperContext

pub struct BasicHyperContext {
    pub body: Body,
    pub query_params: HashMap<String, String, RandomState>,
    pub request: HyperRequest,
    pub status: u16,
    pub headers: HashMap<String, String, RandomState>,
}

Fields

body: Bodyquery_params: HashMap<String, String, RandomState>request: HyperRequeststatus: u16headers: HashMap<String, String, RandomState>

Methods

impl BasicHyperContext[src]

pub fn new() -> BasicHyperContext[src]

pub fn param(&mut self, key: &str) -> Option<&String>[src]

Get a a parameter

pub fn set(&mut self, key: &str, value: &str)[src]

Set a header on the response

pub fn remove(&mut self, key: &str)[src]

Remove a header on the response

pub fn status(&mut self, code: u16)[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 BasicHyperContext[src]

impl HasQueryParams for BasicHyperContext[src]

impl Default for BasicHyperContext[src]

Auto Trait Implementations

Blanket Implementations

impl<T> From for T[src]

impl<T, U> Into for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T> Borrow for T where
    T: ?Sized
[src]

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> BorrowMut for T where
    T: ?Sized
[src]

impl<T, U> TryInto for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<T> Erased for T