[−][src]Struct thruster::Request
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]
T: Deserialize<'a>,
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]
fn set_params(&mut self, params: HashMap<String, String, RandomState>)
[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]
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>,