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.

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<E, F> IntoHandler<E, SyncFnMode> for F
where E: Event, F: Fn(&E, &EventBus) -> HandlerResult + Send + Sync + 'static,

Source§

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

Source§

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

Source§

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