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::route::scan::ResponseData,
the raw-response envelope used for file downloads and other responses that
control their own 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 = ResponseData→ the handler builds the whole response
ⓘ
impl IRequest<UserModel> for GetUserRequest {}
impl IRequest<()> for DeleteUserRequest {}
impl IRequest<ResponseData> for DownloadFileRequest {}Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".