pub trait DispatchableQuery: Send + Sync {
// Provided methods
fn dispatch_query<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = DispatchedQuery> + Send + 'async_trait>>
where Self: Sized + 'static + 'async_trait { ... }
fn query_handler<'async_trait, H>( ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
H: 'async_trait + QueryHandler + Default + 'static { ... }
fn query_middleware<'async_trait, M>(
middleware: M,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
M: FnMut(DispatchedQuery, NextQueryMiddleware) -> BoxFuture<'static, DispatchedQuery> + Send + Sync + 'async_trait + 'static { ... }
fn soft_query_handler<'async_trait, H>( ) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
H: 'async_trait + QueryHandler + Default + 'static { ... }
fn register_query_handler<'async_trait, H>(
handler: H,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
H: 'async_trait + QueryHandler + 'static { ... }
fn register_soft_query_handler<'async_trait, H>(
handler: H,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
where Self: Sized + 'async_trait,
H: 'async_trait + QueryHandler + 'static { ... }
}Expand description
A type that can be used as a query subject can implement this trait. Implementing this trait makes it easy to register an handler and to dispatch the query.
Provided Methods§
Sourcefn dispatch_query<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = DispatchedQuery> + Send + 'async_trait>>where
Self: Sized + 'static + 'async_trait,
fn dispatch_query<'async_trait>(
self,
) -> Pin<Box<dyn Future<Output = DispatchedQuery> + Send + 'async_trait>>where
Self: Sized + 'static + 'async_trait,
Dispatch the query event
Sourcefn query_handler<'async_trait, H>() -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
fn query_handler<'async_trait, H>() -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
Register a handler for for this query
fn query_middleware<'async_trait, M>(
middleware: M,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
M: FnMut(DispatchedQuery, NextQueryMiddleware) -> BoxFuture<'static, DispatchedQuery> + Send + Sync + 'async_trait + 'static,
Sourcefn soft_query_handler<'async_trait, H>() -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
fn soft_query_handler<'async_trait, H>() -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>
Register this handler if the query does not have an existing handler
Sourcefn register_query_handler<'async_trait, H>(
handler: H,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
H: 'async_trait + QueryHandler + 'static,
fn register_query_handler<'async_trait, H>(
handler: H,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
H: 'async_trait + QueryHandler + 'static,
Register the current handler instance as the handler of this query
Sourcefn register_soft_query_handler<'async_trait, H>(
handler: H,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
H: 'async_trait + QueryHandler + 'static,
fn register_soft_query_handler<'async_trait, H>(
handler: H,
) -> Pin<Box<dyn Future<Output = ()> + Send + 'async_trait>>where
Self: Sized + 'async_trait,
H: 'async_trait + QueryHandler + 'static,
Register the current handler instance as the soft handler of this query