Skip to main content

QueryHandlerGat

Trait QueryHandlerGat 

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

Source

type Response

The response type for this query

Source

type HandleFuture<'a>: Future<Output = ApplicationResult<Self::Response>> + Send + 'a where Self: 'a

Future type returned by handle method

Required Methods§

Source

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".

Implementors§

Source§

impl<R, S, F> QueryHandlerGat<GetStreamFramesQuery> for StreamQueryHandler<R, S, F>

Source§

impl<R, S, F> QueryHandlerGat<GetStreamQuery> for StreamQueryHandler<R, S, F>

Source§

impl<R, S, F> QueryHandlerGat<GetStreamsForSessionQuery> for StreamQueryHandler<R, S, F>

Source§

impl<R> QueryHandlerGat<GetActiveSessionsQuery> for SessionQueryHandler<R>

Source§

impl<R> QueryHandlerGat<GetSessionHealthQuery> for SessionQueryHandler<R>

Source§

impl<R> QueryHandlerGat<GetSessionQuery> for SessionQueryHandler<R>

Source§

impl<R> QueryHandlerGat<GetSessionStatsQuery> for SessionQueryHandler<R>

Source§

impl<R> QueryHandlerGat<GetSystemStatsQuery> for SystemQueryHandler<R>

Source§

impl<R> QueryHandlerGat<SearchSessionsQuery> for SessionQueryHandler<R>