DispatchableQuery

Trait DispatchableQuery 

Source
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§

Source

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

Source

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,

Register a handler for for this query

Source

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,

Source

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,

Register this handler if the query does not have an existing handler

Source

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

Source

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

Implementors§