pub struct Request<B = Bytes> { /* private fields */ }Expand description
An HTTP request with method, URL, headers, optional body, and extensions.
Implementations§
Source§impl<B> Request<B>
impl<B> Request<B>
Sourcepub fn builder(method: Method, url: Url) -> RequestBuilder<B>
pub fn builder(method: Method, url: Url) -> RequestBuilder<B>
Creates a new RequestBuilder.
Sourcepub fn headers_mut(&mut self) -> &mut HashMap<String, String>
pub fn headers_mut(&mut self) -> &mut HashMap<String, String>
Mutable access to headers.
Sourcepub fn extensions(&self) -> &Extensions
pub fn extensions(&self) -> &Extensions
Request extensions.
Extensions allow middleware to attach arbitrary typed data to requests.
Sourcepub fn extensions_mut(&mut self) -> &mut Extensions
pub fn extensions_mut(&mut self) -> &mut Extensions
Mutable access to extensions.
Sourcepub fn into_parts(
self,
) -> (Method, Url, HashMap<String, String>, Option<B>, Extensions)
pub fn into_parts( self, ) -> (Method, Url, HashMap<String, String>, Option<B>, Extensions)
Consume into (method, url, headers, body, extensions).
Sourcepub fn from_parts(
method: Method,
url: Url,
headers: HashMap<String, String>,
body: Option<B>,
extensions: Extensions,
) -> Self
pub fn from_parts( method: Method, url: Url, headers: HashMap<String, String>, body: Option<B>, extensions: Extensions, ) -> Self
Construct a request from its parts.
This is the inverse of into_parts and is useful
for middleware that needs to modify a request and reconstruct it.
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for Request<B>where
B: Freeze,
impl<B = Bytes> !RefUnwindSafe for Request<B>
impl<B> Send for Request<B>where
B: Send,
impl<B> Sync for Request<B>where
B: Sync,
impl<B> Unpin for Request<B>where
B: Unpin,
impl<B = Bytes> !UnwindSafe for Request<B>
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