pub trait RequestModel:
Sized
+ Send
+ 'static {
// Required methods
fn param_meta() -> &'static [ParamMeta];
fn bind<'a>(
ctx: &'a mut dyn IHttpContext,
) -> Pin<Box<dyn Future<Output = Result<Self, Error>> + Send + 'a>>;
}Expand description
A type that can be constructed from an HTTP request.
Implemented by #[derive(WebxRequestMeta)]. The endpoint macros call
RequestModel::bind before dispatching to the handler, so a request type
without the derive does not compile.
ⓘ
#[derive(Default, Deserialize, WebxRequestMeta)]
pub struct GetUserRequest {
#[frompath]
pub id: String,
#[fromquery]
pub expand: Option<String>,
}Required Methods§
Sourcefn param_meta() -> &'static [ParamMeta]
fn param_meta() -> &'static [ParamMeta]
OpenAPI parameter metadata for this request type.
Sources are "path", "query", "header", "form", "body",
"claim", or "" for an unmarked field resolved by the route method.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".