pub trait Middleware:
Send
+ Sync
+ 'static {
// Required method
fn handle<'a>(
&'a self,
ctx: &'a mut RequestCtx,
next: Next<'a>,
) -> Pin<Box<dyn Future<Output = Response<JcBody>> + Send + 'a>>;
}Expand description
Wraps request handling. Call next.run(&mut *ctx).await to continue;
return early to short-circuit (auth rejections, rate limits, …).
Required Methods§
fn handle<'a>( &'a self, ctx: &'a mut RequestCtx, next: Next<'a>, ) -> Pin<Box<dyn Future<Output = Response<JcBody>> + Send + 'a>>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".