pub trait Middleware: Send + Sync {
// Required method
fn handle(
&self,
request: &Request,
connection: &ConnectionInfo,
next: &dyn Application,
) -> Result<Response, String>;
}Expand description
A single middleware layer.
Receive the request, call next.execute(request, connection) to pass
control to the next layer (or the inner application), and optionally
inspect or transform the resulting response.
Short-circuit by returning a Response (or Err) without calling next.
Required Methods§
fn handle( &self, request: &Request, connection: &ConnectionInfo, next: &dyn Application, ) -> Result<Response, String>
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".