pub trait Query:
Send
+ Sync
+ 'static {
type Output: Send + Sync + 'static;
}Expand description
A read-only message asking for information.
Each query has exactly one QueryHandler.
Unlike a Command, a query must not mutate
observable state. The framework treats both with the same machinery, but
the distinction is encouraged for clarity.
§Example
use hexeract_core::Query;
use uuid::Uuid;
struct FindUserById {
pub id: Uuid,
}
struct User {
pub id: Uuid,
pub email: String,
}
impl Query for FindUserById {
type Output = Option<User>;
}Required Associated Types§
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".