[][src]Struct thruster::Request

pub struct Request {
    pub headers: SmallVec<[((usize, usize), (usize, usize)); 8]>,
    pub params: HashMap<String, String, RandomState>,
    // some fields omitted
}

The request object is the default request object provied by Thruster. If a different server is used, such as Hyper, then you'll need to reference that server's "request" documentation instead.

Fields

headers: SmallVec<[((usize, usize), (usize, usize)); 8]>params: HashMap<String, String, RandomState>

Methods

impl Request[src]

pub fn new() -> Request[src]

Create a new, blank, request.

pub fn raw_body(&self) -> &[u8][src]

Get the raw pointer to the byte array of the request

pub fn body(&self) -> &str[src]

Get the body as a utf8 encoded string

pub fn method(&self) -> &str[src]

Get the method as a string

pub fn path(&self) -> &str[src]

Get the path as a string ("/some/path")

pub fn version(&self) -> u8[src]

Get the HTTP version

pub fn headers(&self) -> HashMap<String, String, RandomState>[src]

Get an HashMap of the provided headers. The HashMap is lazily computed, so avoid this method unless you need to access headers.

pub fn body_as<'a, T>(&self, body: &'a str) -> Result<T, Error> where
    T: Deserialize<'a>, 
[src]

Automatically apply a serde deserialization to the body

pub fn params(&self) -> &HashMap<String, String, RandomState>[src]

Fetch the params from the route, e.g. The route "/some/:key" when applied to an incoming request for "/some/value" will populate params with { key: "value" }

Trait Implementations

impl Debug for Request[src]

impl Default for Request[src]

impl RequestWithParams for Request[src]

Auto Trait Implementations

impl RefUnwindSafe for Request

impl Send for Request

impl Sync for Request

impl Unpin for Request

impl UnwindSafe for Request

Blanket Implementations

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

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

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

impl<T> From<T> for T[src]

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

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

type Error = Infallible

The type returned in the event of a conversion error.

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

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

The type returned in the event of a conversion error.