Skip to main content

Interceptor

Trait Interceptor 

Source
pub trait Interceptor:
    Send
    + Sync
    + 'static {
    // Required method
    fn around(
        &'static self,
        ctx: RequestContext,
        next: NextHandler,
    ) -> Pin<Box<dyn Future<Output = Response<Body>> + Send>>;
}
Expand description

One layer of the aspect chain.

around must call next.run(ctx) (typically once) to invoke the inner layer. Returning a response without calling next short-circuits the chain — useful for caches and rate limits.

Required Methods§

Source

fn around( &'static self, ctx: RequestContext, next: NextHandler, ) -> Pin<Box<dyn Future<Output = Response<Body>> + Send>>

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§