pub struct Request<B = EmptyBody> {
pub metadata: RequestMetadata,
pub body: B,
}Expand description
A semantic request with an arbitrary body owner. The metadata is also accessible
through dereferencing, e.g. request.fields and request.method.
Fields§
§metadata: RequestMetadata§body: BImplementations§
Source§impl<B> Request<B>
impl<B> Request<B>
pub fn new(method: Method, path: impl Into<Path>, body: B) -> Self
pub fn from_parts(metadata: RequestMetadata, body: B) -> Self
pub fn into_parts(self) -> (RequestMetadata, B)
Sourcepub fn map_body<T>(self, map: impl FnOnce(B) -> T) -> Request<T>
pub fn map_body<T>(self, map: impl FnOnce(B) -> T) -> Request<T>
Move the body through map without cloning or rebuilding the metadata.
Sourcepub fn with_body<T>(self, body: T) -> Request<T>
pub fn with_body<T>(self, body: T) -> Request<T>
Replace and drop the previous body. This does not drain it or establish asynchronous exchange cleanup; an I/O driver retains that responsibility.
pub fn is_head(&self) -> bool
pub fn is_connect(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl<B> Freeze for Request<B>where
B: Freeze,
impl<B> RefUnwindSafe for Request<B>where
B: RefUnwindSafe,
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> UnsafeUnpin for Request<B>where
B: UnsafeUnpin,
impl<B> UnwindSafe for Request<B>where
B: UnwindSafe,
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