Trait KeyState

Source
pub trait KeyState: Debug {
    type Context;
    type Event: Copy + Debug;

    // Provided methods
    fn handle_event(
        &mut self,
        _context: &Self::Context,
        _keymap_index: u16,
        _event: Event<Self::Event>,
    ) -> KeyEvents<Self::Event> { ... }
    fn key_output(&self) -> Option<KeyOutput> { ... }
}
Expand description

Implements functionality for the pressed key.

Required Associated Types§

Source

type Context

The type of Context the pressed key state handles.

Source

type Event: Copy + Debug

The type of Event the pressed key state handles.

Provided Methods§

Source

fn handle_event( &mut self, _context: &Self::Context, _keymap_index: u16, _event: Event<Self::Event>, ) -> KeyEvents<Self::Event>

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

Source

fn key_output(&self) -> Option<KeyOutput>

Output for the pressed key state.

Implementors§