pub struct Input { /* private fields */ }Expand description
The context which holds the received HTTP request.
The value is used throughout the processing in Endpoint and Task.
Implementations§
Source§impl Input
impl Input
Sourcepub fn new(request: Request<()>) -> Input
pub fn new(request: Request<()>) -> Input
Create an instance of Input from components.
Some fields remain uninitialized and their values are set when the corresponding method will be called.
Sourcepub fn enter_scope<F, R>(&self, f: F) -> Rwhere
F: FnOnce() -> R,
pub fn enter_scope<F, R>(&self, f: F) -> Rwhere
F: FnOnce() -> R,
Set the reference to itself to the thread-local storage and execute given closure.
Typically, this method is used in the implementation of Task which holds some closures.
Sourcepub fn with<F, R>(f: F) -> R
pub fn with<F, R>(f: F) -> R
Execute a closure with the reference to the instance of Input from the thread-local storage.
This method is only used in a closure passed to enter_scope.
Otherwise, it will be panic.
Sourcepub fn request(&self) -> &Request<()>
pub fn request(&self) -> &Request<()>
Return a shared reference to the value of raw HTTP request without the message body.
Sourcepub fn media_type(&self) -> Result<Option<&Mime>, InvalidMediaType>
pub fn media_type(&self) -> Result<Option<&Mime>, InvalidMediaType>
Return the reference to the parsed media type in the request header.
This method will perform parsing of the entry Content-type in the request header
if it has not been done yet. If the value is invalid, it will return an Err.
Trait Implementations§
Auto Trait Implementations§
impl !Freeze for Input
impl !RefUnwindSafe for Input
impl Send for Input
impl !Sync for Input
impl Unpin for Input
impl !UnwindSafe for Input
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
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>
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>
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