pub trait IRequest<TResponse>: Send + 'staticwhere
TResponse: Send + 'static,{ }Expand description
Marker trait for a request (command or query) carrying a structured response TResponse.
The HTTP adapter serializes TResponse as JSON, so it must implement
serde::Serialize — unless it is crate::action::Response, the
response-control type used for file downloads and other responses that own
their status, headers and body. That is why this trait itself only requires
Send: the Serialize bound is enforced where the value is actually
serialized.
TResponse: Serialize→ framework writes JSON and sets status 200TResponse = ()→ framework writes no body and sets status 204TResponse = Response→ the handler builds the whole response
ⓘ
impl IRequest<UserModel> for GetUserRequest {}
impl IRequest<()> for DeleteUserRequest {}
impl IRequest<Response> for DownloadFileRequest {}Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".