Trait Handler

Source
pub trait Handler<T, Req, Res>: Clone
where T: Send + Sync + 'static, Req: Send + Sync + 'static, Res: Send + Sync + 'static,
{ type Future: Future<Output = Result<Res>> + Send + 'static; // Required method fn handle(self, resources: Resources, value: Req) -> Self::Future; // Provided method fn into_dyn(self) -> Arc<dyn HandlerWrapperTrait> where Self: Sized + Send + Sync + 'static { ... } }

Required Associated Types§

Source

type Future: Future<Output = Result<Res>> + Send + 'static

Required Methods§

Source

fn handle(self, resources: Resources, value: Req) -> Self::Future

Provided Methods§

Source

fn into_dyn(self) -> Arc<dyn HandlerWrapperTrait>
where Self: Sized + Send + Sync + 'static,

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl<F, Fut, Req, Res, E> Handler<(), Req, Res> for F
where F: FnOnce(Req) -> Fut + Clone + Send + 'static, Req: Sync + Send + 'static, Res: Sync + Send + 'static, E: Error + Sized + Send + Sync + 'static, Fut: Future<Output = Result<Res, E>> + Send,

Source§

type Future = Pin<Box<dyn Future<Output = Result<Res, Error>> + Send>>

Source§

impl<F, Fut, T1, Req, Res, E> Handler<(T1,), Req, Res> for F
where F: FnOnce(T1, Req) -> Fut + Clone + Send + 'static, Req: Sync + Send + 'static, Res: Sync + Send + 'static, T1: FromResources + Clone + Send + Sync + 'static, E: Error + Sized + Send + Sync + 'static, Fut: Future<Output = Result<Res, E>> + Send,

Source§

type Future = Pin<Box<dyn Future<Output = Result<Res, Error>> + Send>>

Source§

impl<F, Fut, T1, T2, Req, Res, E> Handler<(T1, T2), Req, Res> for F
where F: FnOnce(T1, T2, Req) -> Fut + Clone + Send + 'static, Req: Sync + Send + 'static, Res: Sync + Send + 'static, T1: FromResources + Clone + Send + Sync + 'static, T2: FromResources + Clone + Send + Sync + 'static, E: Error + Sized + Send + Sync + 'static, Fut: Future<Output = Result<Res, E>> + Send,

Source§

type Future = Pin<Box<dyn Future<Output = Result<Res, Error>> + Send>>

Source§

impl<F, Fut, T1, T2, T3, Req, Res, E> Handler<(T1, T2, T3), Req, Res> for F
where F: FnOnce(T1, T2, T3, Req) -> Fut + Clone + Send + 'static, Req: Sync + Send + 'static, Res: Sync + Send + 'static, T1: FromResources + Clone + Send + Sync + 'static, T2: FromResources + Clone + Send + Sync + 'static, T3: FromResources + Clone + Send + Sync + 'static, E: Error + Sized + Send + Sync + 'static, Fut: Future<Output = Result<Res, E>> + Send,

Source§

type Future = Pin<Box<dyn Future<Output = Result<Res, Error>> + Send>>

Source§

impl<F, Fut, T1, T2, T3, T4, Req, Res, E> Handler<(T1, T2, T3, T4), Req, Res> for F
where F: FnOnce(T1, T2, T3, T4, Req) -> Fut + Clone + Send + 'static, Req: Sync + Send + 'static, Res: Sync + Send + 'static, T1: FromResources + Clone + Send + Sync + 'static, T2: FromResources + Clone + Send + Sync + 'static, T3: FromResources + Clone + Send + Sync + 'static, T4: FromResources + Clone + Send + Sync + 'static, E: Error + Sized + Send + Sync + 'static, Fut: Future<Output = Result<Res, E>> + Send,

Source§

type Future = Pin<Box<dyn Future<Output = Result<Res, Error>> + Send>>

Source§

impl<F, Fut, T1, T2, T3, T4, T5, Req, Res, E> Handler<(T1, T2, T3, T4, T5), Req, Res> for F
where F: FnOnce(T1, T2, T3, T4, T5, Req) -> Fut + Clone + Send + 'static, Req: Sync + Send + 'static, Res: Sync + Send + 'static, T1: FromResources + Clone + Send + Sync + 'static, T2: FromResources + Clone + Send + Sync + 'static, T3: FromResources + Clone + Send + Sync + 'static, T4: FromResources + Clone + Send + Sync + 'static, T5: FromResources + Clone + Send + Sync + 'static, E: Error + Sized + Send + Sync + 'static, Fut: Future<Output = Result<Res, E>> + Send,

Source§

type Future = Pin<Box<dyn Future<Output = Result<Res, Error>> + Send>>

Source§

impl<F, Fut, T1, T2, T3, T4, T5, T6, Req, Res, E> Handler<(T1, T2, T3, T4, T5, T6), Req, Res> for F
where F: FnOnce(T1, T2, T3, T4, T5, T6, Req) -> Fut + Clone + Send + 'static, Req: Sync + Send + 'static, Res: Sync + Send + 'static, T1: FromResources + Clone + Send + Sync + 'static, T2: FromResources + Clone + Send + Sync + 'static, T3: FromResources + Clone + Send + Sync + 'static, T4: FromResources + Clone + Send + Sync + 'static, T5: FromResources + Clone + Send + Sync + 'static, T6: FromResources + Clone + Send + Sync + 'static, E: Error + Sized + Send + Sync + 'static, Fut: Future<Output = Result<Res, E>> + Send,

Source§

type Future = Pin<Box<dyn Future<Output = Result<Res, Error>> + Send>>

Source§

impl<F, Fut, T1, T2, T3, T4, T5, T6, T7, Req, Res, E> Handler<(T1, T2, T3, T4, T5, T6, T7), Req, Res> for F
where F: FnOnce(T1, T2, T3, T4, T5, T6, T7, Req) -> Fut + Clone + Send + 'static, Req: Sync + Send + 'static, Res: Sync + Send + 'static, T1: FromResources + Clone + Send + Sync + 'static, T2: FromResources + Clone + Send + Sync + 'static, T3: FromResources + Clone + Send + Sync + 'static, T4: FromResources + Clone + Send + Sync + 'static, T5: FromResources + Clone + Send + Sync + 'static, T6: FromResources + Clone + Send + Sync + 'static, T7: FromResources + Clone + Send + Sync + 'static, E: Error + Sized + Send + Sync + 'static, Fut: Future<Output = Result<Res, E>> + Send,

Source§

type Future = Pin<Box<dyn Future<Output = Result<Res, Error>> + Send>>