pub trait Interceptor:
Send
+ Sync
+ 'static {
// Provided methods
fn intercept<'a>(
&'a self,
context: ExecutionContext,
next: CallHandler<'a>,
) -> BoxFuture<'a, Result<BootResponse>> { ... }
fn before(
&self,
_context: ExecutionContext,
) -> BoxFuture<'static, Result<()>> { ... }
fn short_circuit(
&self,
_context: ExecutionContext,
) -> BoxFuture<'static, Result<Option<BootResponse>>> { ... }
fn after(
&self,
_context: ExecutionContext,
response: BootResponse,
) -> BoxFuture<'static, Result<BootResponse>> { ... }
}Expand description
Runs around the handler for cross-cutting behavior.
Provided Methods§
Sourcefn intercept<'a>(
&'a self,
context: ExecutionContext,
next: CallHandler<'a>,
) -> BoxFuture<'a, Result<BootResponse>>
fn intercept<'a>( &'a self, context: ExecutionContext, next: CallHandler<'a>, ) -> BoxFuture<'a, Result<BootResponse>>
Run around the remaining HTTP pipeline.
Override this method to catch or replace downstream errors, retry the
handler, apply a timeout, or return a response without calling next.
The default implementation preserves the legacy before,
short_circuit, and after hook behavior.
fn before(&self, _context: ExecutionContext) -> BoxFuture<'static, Result<()>>
fn short_circuit( &self, _context: ExecutionContext, ) -> BoxFuture<'static, Result<Option<BootResponse>>>
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".