Struct finchers_core::Input
[−]
[src]
pub struct Input { /* fields omitted */ }
The context which holds the received HTTP request.
The value is used throughout the processing in Endpoint
and Task
.
Methods
impl Input
[src]
pub fn new(request: Request<()>) -> Input
[src]
Create an instance of Input
from components.
Some fields remain uninitialized and their values are set when the corresponding method will be called.
pub fn enter_scope<F, R>(&self, f: F) -> R where
F: FnOnce() -> R,
[src]
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.
pub fn with<F, R>(f: F) -> R where
F: FnOnce(&Input) -> R,
[src]
F: FnOnce(&Input) -> 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.
pub fn request(&self) -> &Request<()>
[src]
Return a shared reference to the value of raw HTTP request without the message body.
pub fn media_type(&self) -> Result<Option<&Mime>, InvalidMediaType>
[src]
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
.