pub struct Request<P = PayloadStream> { /* private fields */ }
Expand description
Request
Implementations§
Source§impl Request<PayloadStream>
impl Request<PayloadStream>
Sourcepub fn new() -> Request<PayloadStream>
pub fn new() -> Request<PayloadStream>
Create new Request instance
Source§impl<P> Request<P>
impl<P> Request<P>
Sourcepub fn with_payload(payload: Payload<P>) -> Request<P>
pub fn with_payload(payload: Payload<P>) -> Request<P>
Create new Request instance
Sourcepub fn replace_payload<P1>(
self,
payload: Payload<P1>,
) -> (Request<P1>, Payload<P>)
pub fn replace_payload<P1>( self, payload: Payload<P1>, ) -> (Request<P1>, Payload<P>)
Create new Request instance
Sourcepub fn take_payload(&mut self) -> Payload<P>
pub fn take_payload(&mut self) -> Payload<P>
Get request’s payload
Sourcepub fn into_parts(self) -> (Message<RequestHead>, Payload<P>)
pub fn into_parts(self) -> (Message<RequestHead>, Payload<P>)
Split request into request head and payload
Sourcepub fn head(&self) -> &RequestHead
pub fn head(&self) -> &RequestHead
Http message part of the request
Sourcepub fn headers_mut(&mut self) -> &mut HeaderMap
pub fn headers_mut(&mut self) -> &mut HeaderMap
Mutable reference to the message’s headers.
Sourcepub fn peer_addr(&self) -> Option<SocketAddr>
pub fn peer_addr(&self) -> Option<SocketAddr>
Peer socket address
Peer address is actual socket address, if proxy is used in front of scrappy http server, then peer address would be address of this proxy.
Trait Implementations§
Source§impl From<Message<RequestHead>> for Request<PayloadStream>
impl From<Message<RequestHead>> for Request<PayloadStream>
Source§fn from(head: Message<RequestHead>) -> Self
fn from(head: Message<RequestHead>) -> Self
Converts to this type from the input type.
Source§impl<P> HttpMessage for Request<P>
impl<P> HttpMessage for Request<P>
Source§fn extensions(&self) -> Ref<'_, Extensions>
fn extensions(&self) -> Ref<'_, Extensions>
Request extensions
Source§fn extensions_mut(&self) -> RefMut<'_, Extensions>
fn extensions_mut(&self) -> RefMut<'_, Extensions>
Mutable reference to a the request’s extensions
Source§fn take_payload(&mut self) -> Payload<P>
fn take_payload(&mut self) -> Payload<P>
Message payload stream
Source§fn content_type(&self) -> &str
fn content_type(&self) -> &str
Read the request content type. If request does not contain
Content-Type header, empty str get returned.
Source§fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>
fn encoding(&self) -> Result<&'static Encoding, ContentTypeError>
Get content type encoding Read more
Source§fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>
fn mime_type(&self) -> Result<Option<Mime>, ContentTypeError>
Convert the request content type to a known mime type.
Load request cookies.
Return request cookie.
Auto Trait Implementations§
impl<P> Freeze for Request<P>where
P: Freeze,
impl<P = Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>>>>> !RefUnwindSafe for Request<P>
impl<P = Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>>>>> !Send for Request<P>
impl<P = Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>>>>> !Sync for Request<P>
impl<P> Unpin for Request<P>where
P: Unpin,
impl<P = Pin<Box<dyn Stream<Item = Result<Bytes, PayloadError>>>>> !UnwindSafe for Request<P>
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
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> 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 more