Skip to main content

IntoHandler

Trait IntoHandler 

Source
pub trait IntoHandler<E: Event, Mode> { }
Expand description

Type-erases a concrete handler into the internal representation expected by the bus registry.

This trait is implemented for:

The Mode type parameter is inferred by the compiler from the concrete handler type; callers never need to name it explicitly.

You do not need to implement this trait manually — it is a blanket implementation over EventHandler and SyncEventHandler.

Implementors§

Source§

impl<E, F> IntoHandler<E, SyncFnMode> for F
where E: Event, F: Fn(&E) -> HandlerResult + Send + Sync + 'static,

Source§

impl<E, F, Fut> IntoHandler<E, AsyncFnMode> for F
where E: Event + Clone, F: Fn(E) -> Fut + Send + Sync + 'static, Fut: Future<Output = HandlerResult> + Send + 'static,

Source§

impl<E, H> IntoHandler<E, AsyncMode> for H
where E: Event + Clone, H: EventHandler<E>,

Source§

impl<E, H> IntoHandler<E, SyncMode> for H
where E: Event, H: SyncEventHandler<E>,