pub struct Request { /* private fields */ }Expand description
Framework-agnostic HTTP request.
Adapters copy method, path, optional query string, headers, and body from the server crate.
Implementations§
Source§impl Request
impl Request
Sourcepub fn new(method: Method, path: impl Into<String>) -> Request
pub fn new(method: Method, path: impl Into<String>) -> Request
Builds a request with an empty body, headers, and attributes.
Sourcepub fn with_header(
self,
name: impl AsRef<str>,
value: impl Into<String>,
) -> Request
pub fn with_header( self, name: impl AsRef<str>, value: impl Into<String>, ) -> Request
Replaces the header map after insert.
Sourcepub fn with_query(self, query: impl Into<String>) -> Request
pub fn with_query(self, query: impl Into<String>) -> Request
Sets the raw query string without a leading ?.
Sourcepub fn query(&self) -> Option<&str>
pub fn query(&self) -> Option<&str>
Raw query string without a leading ?, when the adapter provided one.
Sourcepub const fn headers_mut(&mut self) -> &mut Headers
pub const fn headers_mut(&mut self) -> &mut Headers
Mutable headers (adapters and middleware).
Sourcepub const fn attributes(&self) -> &AttributeBag
pub const fn attributes(&self) -> &AttributeBag
Request attributes.
Sourcepub const fn attributes_mut(&mut self) -> &mut AttributeBag
pub const fn attributes_mut(&mut self) -> &mut AttributeBag
Mutable attributes (middleware, router, controller).
Trait Implementations§
Auto Trait Implementations§
impl !RefUnwindSafe for Request
impl !UnwindSafe for Request
impl Forget for Request
impl Freeze for Request
impl Move 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
impl<A, B, T> HttpServerConnExec<A, B> for Twhere
B: Body,
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§impl<T> PolicyExt for Twhere
T: ?Sized,
impl<T> PolicyExt for Twhere
T: ?Sized,
Source§impl<T> SerializableKey for T
impl<T> SerializableKey for T
Source§impl<T> StorageAccess<T> for T
impl<T> StorageAccess<T> for T
Source§fn as_borrowed(&self) -> &T
fn as_borrowed(&self) -> &T
Borrows the value.
Source§fn into_taken(self) -> T
fn into_taken(self) -> T
Takes the value.