Skip to main content

HandlerExecutor

Trait HandlerExecutor 

Source
pub trait HandlerExecutor<C, T>: Send + Sync {
    type Future<'a>: Future<Output = Result<T>> + Send + 'a
       where Self: 'a,
             C: 'a,
             T: 'a;

    // Required methods
    fn execute<'a>(&'a self, ctx: C) -> Self::Future<'a>
       where C: 'a;
    fn is_async(&self) -> bool;
}
Expand description

Core trait for handler execution with GAT to support both sync and async

Required Associated Types§

Source

type Future<'a>: Future<Output = Result<T>> + Send + 'a where Self: 'a, C: 'a, T: 'a

Required Methods§

Source

fn execute<'a>(&'a self, ctx: C) -> Self::Future<'a>
where C: 'a,

Source

fn is_async(&self) -> bool

Dyn Compatibility§

This trait is not dyn compatible.

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

Implementors§

Source§

impl<F, C, T> HandlerExecutor<C, T> for SyncExecutor<F, C, T>
where F: Fn(C) -> Result<T> + Send + Sync, C: Send + 'static, T: Send + 'static,

Source§

type Future<'a> = Ready<Result<T, Error>> where Self: 'a, C: 'a, T: 'a

Source§

impl<F, Fut, C, T> HandlerExecutor<C, T> for AsyncExecutor<F, C, T>
where F: Fn(C) -> Fut + Send + Sync, Fut: Future<Output = Result<T>> + Send + 'static, C: Send + 'static, T: Send + 'static,

Source§

type Future<'a> = Pin<Box<dyn Future<Output = Result<T, Error>> + Send + 'a>> where Self: 'a, C: 'a, T: 'a