pub trait RoutableHttpEvent:
Send
+ Sync
+ Clone
+ 'static {
// Required methods
fn raw_path(&self) -> Option<String>;
fn http_method(&self) -> String;
// Provided methods
fn resource(&self) -> Option<String> { ... }
fn path_parameters(&self) -> Option<&HashMap<String, String>> { ... }
}Expand description
A trait for HTTP events that can be routed by the router.
This trait defines the minimum requirements for an HTTP event to be usable with the routing system. Any event type that implements this trait can be used with the router.
§Examples
use lambda_lw_http_router_core::RoutableHttpEvent;
#[derive(Clone)] // Required by RoutableHttpEvent
struct CustomHttpEvent {
path: String,
method: String,
}
impl RoutableHttpEvent for CustomHttpEvent {
fn raw_path(&self) -> Option<String> {
Some(self.path.clone())
}
fn http_method(&self) -> String {
self.method.clone()
}
}Required Methods§
Sourcefn http_method(&self) -> String
fn http_method(&self) -> String
Returns the HTTP method of the request
Provided Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.