Skip to main content

QueryHandler

Trait QueryHandler 

Source
pub trait QueryHandler<Q: Query>:
    Send
    + Sync
    + 'static
    + Send {
    type Error: Into<HexeractError> + Send + Sync + 'static;

    // Required method
    fn handle(
        &self,
        query: Q,
        ctx: &HandlerContext,
    ) -> impl Future<Output = Result<Q::Output, Self::Error>> + Send;
}
Expand description

Asynchronous handler for a Query.

Required Associated Types§

Source

type Error: Into<HexeractError> + Send + Sync + 'static

The handler-defined error type, convertible into HexeractError.

Required Methods§

Source

fn handle( &self, query: Q, ctx: &HandlerContext, ) -> impl Future<Output = Result<Q::Output, Self::Error>> + Send

Handles the query and produces its output.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§