Trait Context
pub trait Context: Clone + Copy {
type Event;
// Required methods
fn handle_event(
&mut self,
event: Event<Self::Event>,
) -> KeyEvents<Self::Event>;
fn reset(&mut self);
}Expand description
Used to provide state that may affect behaviour when pressing the key.
e.g. the behaviour of layered::LayeredKey depends on which layers are active in layered::Context.
Required Associated Types§
type Event
type Event
The type of Event the context handles.
Required Methods§
fn handle_event(&mut self, event: Event<Self::Event>) -> KeyEvents<Self::Event>
fn handle_event(&mut self, event: Event<Self::Event>) -> KeyEvents<Self::Event>
Used to update the Context’s state.
fn reset(&mut self)
fn reset(&mut self)
Restore runtime state from this context’s keymap config.
Config data (timeouts, chords, …) is preserved; ephemeral state (active layers, sticky mods, queues, …) is cleared.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".