pub trait EnhancedMiddleware: Send + Sync {
// Required methods
fn before_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 mut Request,
) -> Pin<Box<dyn Future<Output = Result<Option<Response>>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn after_response<'life0, 'life1, 'async_trait>(
&'life0 self,
response: &'life1 mut Response,
) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait;
fn name(&self) -> &'static str;
// Provided method
fn is_enabled(&self) -> bool { ... }
}Expand description
Enhanced middleware trait with configuration support
Required Methods§
Sourcefn before_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 mut Request,
) -> Pin<Box<dyn Future<Output = Result<Option<Response>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
fn before_request<'life0, 'life1, 'async_trait>(
&'life0 self,
request: &'life1 mut Request,
) -> Pin<Box<dyn Future<Output = Result<Option<Response>>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
'life1: 'async_trait,
Process a request before it reaches the handler
Provided Methods§
Sourcefn is_enabled(&self) -> bool
fn is_enabled(&self) -> bool
Check if middleware is enabled