Skip to main content

Interceptor

Trait Interceptor 

Source
pub trait Interceptor:
    Send
    + Sync
    + 'static {
    // Provided methods
    fn before(
        &self,
        _context: ExecutionContext,
    ) -> BoxFuture<'static, Result<()>> { ... }
    fn after(
        &self,
        _context: ExecutionContext,
        response: BootResponse,
    ) -> BoxFuture<'static, Result<BootResponse>> { ... }
}
Expand description

Runs around the handler for cross-cutting behavior.

Provided Methods§

Source

fn before(&self, _context: ExecutionContext) -> BoxFuture<'static, Result<()>>

Source

fn after( &self, _context: ExecutionContext, response: BootResponse, ) -> BoxFuture<'static, Result<BootResponse>>

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§

Source§

impl<F, Fut> Interceptor for F
where F: Fn(ExecutionContext) -> Fut + Send + Sync + 'static, Fut: Future<Output = Result<()>> + Send + 'static,