pub trait EventHandler<E, Args, T = ()>: 'static {
// Required method
fn call(&mut self, event: E, env: &Environment) -> T;
}Expand description
A repeatable event handler that consumes a typed event payload plus environment-extracted arguments.
Implemented for any closure of the form FnMut(E, A1, ..., An) -> T
where each Ai: Extractor. The shape mirrors Handler but inserts
an “event” position in the leading argument slot. This lets event
callbacks on views like Photo::on_event, Video::on_event, and
WebView::on_event reuse the same State<T> / Environment extractor
machinery as Button::action.
The Args tuple only counts extractor positions — the event payload is
not part of the tuple — so a closure like |event: E| { ... } matches
EventHandler<E, (), ()> and reads as “no extractors, returns unit”.
Required Methods§
Sourcefn call(&mut self, event: E, env: &Environment) -> T
fn call(&mut self, event: E, env: &Environment) -> T
Invokes the handler with the given event payload and the extractor
arguments resolved from env.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".