pub struct Request { /* private fields */ }Implementations§
Source§impl Request
impl Request
pub fn new(method: Method, uri: Uri) -> Self
pub fn from_parts( method: Method, uri: Uri, headers: HeaderMap, body: Bytes, ) -> Self
pub fn method(&self) -> &Method
pub fn uri(&self) -> &Uri
pub const fn version(&self) -> Version
pub fn headers(&self) -> &HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Sourcepub fn body(&self) -> &Bytes
pub fn body(&self) -> &Bytes
Return the fully buffered request body.
Streaming routes keep this buffer empty; use Self::take_body_stream
or the RequestBodyStream extractor on those routes.
pub const fn is_body_streaming(&self) -> bool
Sourcepub fn take_body_stream(
&self,
) -> Result<RequestBodyStream, RequestBodyStreamRejection>
pub fn take_body_stream( &self, ) -> Result<RequestBodyStream, RequestBodyStreamRejection>
Sourcepub fn json<T: DeserializeOwned>(&self) -> Result<T, JsonRejection>
pub fn json<T: DeserializeOwned>(&self) -> Result<T, JsonRejection>
Deserialize the request body as JSON.
§Errors
Returns an error when Content-Type is not JSON or the body is not
valid JSON for T.
pub fn param(&self, name: &str) -> Option<&str>
pub fn route_name(&self) -> Option<&str>
pub fn extensions(&self) -> &Extensions
pub fn extensions_mut(&mut self) -> &mut Extensions
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Request
impl !RefUnwindSafe for Request
impl !UnwindSafe for Request
impl Send for Request
impl Sync for Request
impl Unpin for Request
impl UnsafeUnpin for Request
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more