[−][src]Trait mendes::application::Application
Main interface for an application or service
The Application
holds state and routes request to the proper handlers. A handler gets
an immutable reference to the Application
to access application state. Common usage
for this would be to hold a persistent storage connection pool.
The Application
also helps process handler reponses. It can handle errors and turn them
into HTTP responses, using the error()
method to transform the Error
associated type
into a Response
.
Associated Types
type RequestBody: Send
type ResponseBody: Send
type Error: Responder<Self> + WithStatus + From<Error> + Send
Required methods
#[must_use]fn handle<'async_trait>(
self: Arc<Self>,
req: Request<Self::RequestBody>
) -> Pin<Box<dyn Future<Output = Response<Self::ResponseBody>> + Send + 'async_trait>> where
Self: 'async_trait,
self: Arc<Self>,
req: Request<Self::RequestBody>
) -> Pin<Box<dyn Future<Output = Response<Self::ResponseBody>> + Send + 'async_trait>> where
Self: 'async_trait,
Provided methods
fn from_body_bytes<'de, T: Deserialize<'de>>(
req: &Parts,
bytes: &'de [u8]
) -> Result<T, Error>
req: &Parts,
bytes: &'de [u8]
) -> Result<T, Error>
fn redirect(status: StatusCode, path: &str) -> Response<Self::ResponseBody> where
Self::ResponseBody: Default,
Self::ResponseBody: Default,