pub trait RequestHandler: Send + Sync {
// Required methods
fn handle<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
context: RequestContext,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>
where Self: 'async_trait,
'life0: 'async_trait;
fn name(&self) -> &str;
fn can_handle(&self, request: &HttpRequest) -> bool;
}Expand description
Request handler trait for processing HTTP requests
Required Methods§
Sourcefn handle<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
context: RequestContext,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
fn handle<'life0, 'async_trait>(
&'life0 self,
request: HttpRequest,
context: RequestContext,
) -> Pin<Box<dyn Future<Output = Result<HttpResponse>> + Send + 'async_trait>>where
Self: 'async_trait,
'life0: 'async_trait,
Handle an HTTP request
Sourcefn can_handle(&self, request: &HttpRequest) -> bool
fn can_handle(&self, request: &HttpRequest) -> bool
Check if handler supports the request
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".