Skip to main content

KeyState

Trait KeyState 

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§

type Context

The type of Context the pressed key state handles.

type Event: Copy + Debug

The type of Event the pressed key state handles.

Provided Methods§

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).

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

Output for the pressed key state.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§