pub struct Input<'task> {
pub request: &'task Request<()>,
pub params: &'task Option<Params<'task>>,
pub states: &'task States<'task>,
pub cookies: &'task mut Cookies<'task>,
pub locals: &'task mut LocalMap,
/* private fields */
}
Expand description
A proxy object for accessing the contextual information about incoming HTTP request and global/request-local state.
Fields
request: &'task Request<()>
The information of incoming request without the message body.
params: &'task Option<Params<'task>>
A set of extracted parameters from router.
states: &'task States<'task>
A proxy object for accessing shared states.
A proxy object for accessing Cookie values.
locals: &'task mut LocalMap
A typemap that holds arbitrary request-local data.
Implementations
sourceimpl<'task> Input<'task>
impl<'task> Input<'task>
sourcepub fn body(&mut self) -> Option<RequestBody>
pub fn body(&mut self) -> Option<RequestBody>
Takes a raw instance of incoming message body from the context.
sourcepub fn upgrade<F, R>(&mut self, on_upgrade: F) -> Result<(), F>where
F: FnOnce(UpgradedIo) -> R + Send + 'static,
R: IntoFuture<Item = (), Error = ()>,
R::Future: Send + 'static,
pub fn upgrade<F, R>(&mut self, on_upgrade: F) -> Result<(), F>where
F: FnOnce(UpgradedIo) -> R + Send + 'static,
R: IntoFuture<Item = (), Error = ()>,
R::Future: Send + 'static,
Registers the upgrade handler to the context.
sourcepub fn is_upgraded(&self) -> bool
pub fn is_upgraded(&self) -> bool
Returns ‘true’ if the context has already upgraded.
sourcepub fn content_type(&mut self) -> Result<Option<&Mime>, Error>
pub fn content_type(&mut self) -> Result<Option<&Mime>, Error>
Parses the header field Content-type
and stores it into the localmap.
pub fn response_headers(&mut self) -> &mut HeaderMap
pub fn allowed_methods<'a>(
&'a self
) -> Option<impl Iterator<Item = &'a Method> + 'a>
sourceimpl<'task> Input<'task>
impl<'task> Input<'task>
sourcepub fn with_set_current<F, R>(&mut self, f: F) -> Rwhere
F: FnOnce() -> R,
pub fn with_set_current<F, R>(&mut self, f: F) -> Rwhere
F: FnOnce() -> R,
Stores this reference to the task local storage and executes the specified closure.
The stored reference to Input
can be accessed by using input::with_get_current
.
Trait Implementations
Auto Trait Implementations
impl<'task> !RefUnwindSafe for Input<'task>
impl<'task> !Send for Input<'task>
impl<'task> !Sync for Input<'task>
impl<'task> Unpin for Input<'task>
impl<'task> !UnwindSafe for Input<'task>
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more