pub struct Request {
pub headers: SmallVec<[((usize, usize), (usize, usize)); 8]>,
pub params: Option<HashMap<String, String>>,
/* private fields */
}
Expand description
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: Option<HashMap<String, String>>
Implementations
sourceimpl Request
impl Request
sourcepub fn raw_body(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
pub fn raw_body(&self) -> &[u8]ⓘNotable traits for &mut [u8]impl Write for &mut [u8]impl Read for &[u8]
Get the raw pointer to the byte array of the request
sourcepub fn headers(&self) -> HashMap<String, Vec<String>>
pub fn headers(&self) -> HashMap<String, Vec<String>>
Get an HashMap of the provided headers. The HashMap is lazily computed, so avoid this method unless you need to access headers.
sourcepub fn body_as<'a, T>(&self, body: &'a str) -> Result<T>where
T: Deserialize<'a>,
pub fn body_as<'a, T>(&self, body: &'a str) -> Result<T>where
T: Deserialize<'a>,
Automatically apply a serde deserialization to the body
sourcepub fn body_json<T>(&self) -> Result<T>where
T: DeserializeOwned,
pub fn body_json<T>(&self) -> Result<T>where
T: DeserializeOwned,
Reading body as json with given Deserialize struct
Trait Implementations
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
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more