smart_keymap::key

Trait PressedKeyState

Source
pub trait PressedKeyState<K>: Debug {
    type Context;
    type Event;

    // Required methods
    fn handle_event_for(
        &mut self,
        context: Self::Context,
        keymap_index: u16,
        key: &K,
        event: Event<Self::Event>,
    ) -> PressedKeyEvents<Self::Event>;
    fn key_output(&self, key: &K) -> KeyOutputState;
}
Expand description

Implements functionality for the pressed key.

e.g. tap_hold::PressedKeyState implements behaviour resolving the pressed tap hold key as either ‘tap’ or ‘hold’.

Required Associated Types§

Source

type Context

The type of Context the pressed key state handles.

Source

type Event

The type of Event the pressed key state handles.

Required Methods§

Source

fn handle_event_for( &mut self, context: Self::Context, keymap_index: u16, key: &K, event: Event<Self::Event>, ) -> PressedKeyEvents<Self::Event>

Used to update the PressedKeyState’s state, and possibly yield event(s).

Source

fn key_output(&self, key: &K) -> KeyOutputState

Output for the pressed key state.

Implementors§