pub struct InverseKeymap { /* private fields */ }
Expand description
Lightweight utility for basic keymap conversion of chars to keystrokes.
This is intended for end-to-end and input testing only; for production use cases and general
testing, IME injection should be used instead. Generally a mapping exists only for printable
ASCII characters; in particular neither '\t'
nor '\n'
is mapped in either of the standard
zircon keymaps. Furthermore, IME implementations may themselves override the keymap in a way
that invalidates this translation.
This is an inverse of hid/hid.h:hid_map_key.
Implementations§
Source§impl InverseKeymap
impl InverseKeymap
Sourcepub fn new(keymap: &Keymap<'_>) -> Self
pub fn new(keymap: &Keymap<'_>) -> Self
Creates an inverse keymap from a specialized keymap
array. The value of this array at
index u
, where u
is the usage, can be:
None
if the key maps to nochar
(Esc key)Some((c, None))
if the key maps toc
, but does not map to anychar
when shift is pressedSome((c, Some(cs)))
if the key maps toc
when shift is not pressed and tocs
when it is pressed
§Examples
let _keymap = InverseKeymap::new(&US_QWERTY);
pub fn get(&self, c: &char) -> Option<&KeyStroke>
Trait Implementations§
Auto Trait Implementations§
impl Freeze for InverseKeymap
impl RefUnwindSafe for InverseKeymap
impl Send for InverseKeymap
impl Sync for InverseKeymap
impl Unpin for InverseKeymap
impl UnwindSafe for InverseKeymap
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