pub trait Middleware:
Send
+ Sync
+ Debug {
// Required method
fn handle(
&self,
request: ElifRequest,
next: Next,
) -> Pin<Box<dyn Future<Output = ElifResponse> + Send>>;
// Provided method
fn name(&self) -> &'static str { ... }
}
Expand description
New middleware trait with Laravel-style handle(request, next) pattern Uses boxed futures to be dyn-compatible
Required Methods§
Sourcefn handle(
&self,
request: ElifRequest,
next: Next,
) -> Pin<Box<dyn Future<Output = ElifResponse> + Send>>
fn handle( &self, request: ElifRequest, next: Next, ) -> Pin<Box<dyn Future<Output = ElifResponse> + Send>>
Handle the request and call the next middleware in the chain