elif_http/foundation/
types.rs1use crate::errors::HttpResult;
2use std::future::Future;
3use std::pin::Pin;
4
5pub type BoxFuture<'a, T> = Pin<Box<dyn Future<Output = T> + Send + 'a>>;
6
7pub trait GenericHandler<T>: Clone + Send + Sync + 'static {
8 type Response;
9
10 fn call(&self, request: T) -> BoxFuture<'_, HttpResult<Self::Response>>;
11}
12
13pub trait IntoElifResponse {
14 fn into_response(self) -> crate::response::ElifResponse;
15}
16
17pub trait RequestExtractor: Sized + Send + 'static {
18 type Error;
19
20 fn extract(request: &crate::request::ElifRequest) -> Result<Self, Self::Error>;
21}