pub trait Handler<A, M>:
Send
+ Sync
+ 'static { }Expand description
Something that can handle A (an Event or a
ConnectionState) together with the Client.
Implemented for
Fn(A, Client) -> impl Future<Output = ()>:|event, client| async move { .. }, run on the client’s event task;Fn(A, Client): a plain closure, run on tokio’s blocking pool so it may block.
Handlers run one at a time, in arrival order. The marker M only tells the two apart.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".