pub trait QueryHandlerGat<TQuery> {
type Response;
type HandleFuture<'a>: Future<Output = ApplicationResult<Self::Response>> + Send + 'a
where Self: 'a;
// Required method
fn handle(&self, query: TQuery) -> Self::HandleFuture<'_>;
}Expand description
GAT-based query handler trait for zero-cost async
This trait uses Generic Associated Types instead of async_trait to avoid the boxing overhead of dynamic dispatch.
Required Associated Types§
Sourcetype HandleFuture<'a>: Future<Output = ApplicationResult<Self::Response>> + Send + 'a
where
Self: 'a
type HandleFuture<'a>: Future<Output = ApplicationResult<Self::Response>> + Send + 'a where Self: 'a
Future type returned by handle method
Required Methods§
Sourcefn handle(&self, query: TQuery) -> Self::HandleFuture<'_>
fn handle(&self, query: TQuery) -> Self::HandleFuture<'_>
Handle the query and return a future
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".