pub trait Controller {
// Required methods
fn handle(
&mut self,
widget: WidgetId,
event: &Event,
out: &mut Vec<ControllerEvent>,
);
fn event_mask(&self) -> EventMask;
}Expand description
An input pattern that turns raw Events into ControllerEvents.
Implement it to add a pattern of your own; the Widget side is unchanged.
Required Methods§
Sourcefn handle(
&mut self,
widget: WidgetId,
event: &Event,
out: &mut Vec<ControllerEvent>,
)
fn handle( &mut self, widget: WidgetId, event: &Event, out: &mut Vec<ControllerEvent>, )
Examines one event.
§Arguments
widget- The ID of theWidgetthat owns the controller.event- The event theWidgetreceived.out- Where to push the results, in order.
Sourcefn event_mask(&self) -> EventMask
fn event_mask(&self) -> EventMask
Returns the event classes the controller needs.
§Returns
The mask WidgetCore::add_controller adds to
the Widget’s event mask.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".