QueryHandler

Trait QueryHandler 

Source
pub trait QueryHandler<Q: Query>: Send + Sync {
    // Required method
    fn handle<'life0, 'async_trait>(
        &'life0 self,
        query: Q,
    ) -> Pin<Box<dyn Future<Output = Result<Q::Result>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait;

    // Provided method
    fn validate_query<'life0, 'life1, 'async_trait>(
        &'life0 self,
        query: &'life1 Q,
    ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
       where Self: 'async_trait,
             'life0: 'async_trait,
             'life1: 'async_trait { ... }
}
Expand description

Query handler trait for processing queries

Required Methods§

Source

fn handle<'life0, 'async_trait>( &'life0 self, query: Q, ) -> Pin<Box<dyn Future<Output = Result<Q::Result>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait,

Handle the query and return the result

Provided Methods§

Source

fn validate_query<'life0, 'life1, 'async_trait>( &'life0 self, query: &'life1 Q, ) -> Pin<Box<dyn Future<Output = Result<()>> + Send + 'async_trait>>
where Self: 'async_trait, 'life0: 'async_trait, 'life1: 'async_trait,

Validate the query (optional additional validation)

Implementors§