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:
- Structs implementing
EventHandler<E>(selectsAsyncMode). - Structs implementing
SyncEventHandler<E>(selectsSyncMode). async fn(E, EventBus) -> HandlerResultclosures / function pointers (selectsAsyncFnMode).fn(&E, &EventBus) -> HandlerResultclosures / function pointers (selectsSyncFnMode).
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.