pub struct Keymap<I: Index<usize, Output = R>, R, Ctx, Ev: Debug, PKS, KS, S> { /* private fields */ }
Expand description
State for a keymap that handles input, and outputs HID keyboard reports.
Implementations§
Source§impl<I: Debug + Index<usize, Output = R>, R: Copy + Debug, Ctx: Debug + Context<Event = Ev> + SetKeymapContext, Ev: Copy + Debug, PKS: Debug, KS, S: System<R, Ref = R, Context = Ctx, Event = Ev, PendingKeyState = PKS, KeyState = KS>> Keymap<I, R, Ctx, Ev, PKS, KS, S>
impl<I: Debug + Index<usize, Output = R>, R: Copy + Debug, Ctx: Debug + Context<Event = Ev> + SetKeymapContext, Ev: Copy + Debug, PKS: Debug, KS, S: System<R, Ref = R, Context = Ctx, Event = Ev, PendingKeyState = PKS, KeyState = KS>> Keymap<I, R, Ctx, Ev, PKS, KS, S>
Sourcepub const fn new(key_refs: I, context: Ctx, key_system: S) -> Self
pub const fn new(key_refs: I, context: Ctx, key_system: S) -> Self
Constructs a new keymap with the given key definitions and context.
Sourcepub fn set_callback(&mut self, callback_id: KeymapCallback, callback_fn: fn())
pub fn set_callback(&mut self, callback_id: KeymapCallback, callback_fn: fn())
Registers the given callback to the keymap.
Only one callback is set for each callback id.
Sourcepub fn set_callback_extern(
&mut self,
callback_id: KeymapCallback,
callback_fn: extern "C" fn(),
)
pub fn set_callback_extern( &mut self, callback_id: KeymapCallback, callback_fn: extern "C" fn(), )
Registers the given callback to the keymap.
Only one callback is set for each callback id.
Sourcepub fn set_ms_per_tick(&mut self, ms_per_tick: u8)
pub fn set_ms_per_tick(&mut self, ms_per_tick: u8)
Sets the number of ms per tick().
Sourcepub fn handle_input(&mut self, ev: Event)
pub fn handle_input(&mut self, ev: Event)
Handles input events.
Sourcepub fn pressed_keys(&self) -> Vec<KeyOutput, { MAX_PRESSED_KEYS }>
pub fn pressed_keys(&self) -> Vec<KeyOutput, { MAX_PRESSED_KEYS }>
Returns the the pressed key outputs.
Sourcepub fn report_output(&mut self) -> KeymapOutput
pub fn report_output(&mut self) -> KeymapOutput
Updates the keymap indicating a report is sent; returns the reportable keymap output.
Trait Implementations§
Auto Trait Implementations§
impl<I, R, Ctx, Ev, PKS, KS, S> !Freeze for Keymap<I, R, Ctx, Ev, PKS, KS, S>
impl<I, R, Ctx, Ev, PKS, KS, S> !RefUnwindSafe for Keymap<I, R, Ctx, Ev, PKS, KS, S>
impl<I, R, Ctx, Ev, PKS, KS, S> Send for Keymap<I, R, Ctx, Ev, PKS, KS, S>
impl<I, R, Ctx, Ev, PKS, KS, S> !Sync for Keymap<I, R, Ctx, Ev, PKS, KS, S>
impl<I, R, Ctx, Ev, PKS, KS, S> Unpin for Keymap<I, R, Ctx, Ev, PKS, KS, S>
impl<I, R, Ctx, Ev, PKS, KS, S> UnwindSafe for Keymap<I, R, Ctx, Ev, PKS, KS, S>where
I: UnwindSafe,
S: UnwindSafe,
Ctx: UnwindSafe,
R: UnwindSafe,
PKS: UnwindSafe,
KS: UnwindSafe,
Ev: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more