pub trait EguiKeyExt: Sealed {
// Required method
fn to_key(&self) -> Option<Key>;
}Expand description
Convert an egui::Key to a kbd Key.
Returns None for egui keys that represent logical/shifted characters
without a single physical key equivalent (e.g., Colon, Pipe,
Plus, Questionmark). Most egui keys map directly to a physical
key position.
This trait is sealed and cannot be implemented outside this crate.
Required Methods§
Sourcefn to_key(&self) -> Option<Key>
fn to_key(&self) -> Option<Key>
Convert this egui key to a kbd Key, or None if unmappable.
§Examples
use egui::Key as EguiKey;
use kbd::prelude::*;
use kbd_egui::EguiKeyExt;
assert_eq!(EguiKey::A.to_key(), Some(Key::A));
assert_eq!(EguiKey::F5.to_key(), Some(Key::F5));
// Shifted characters have no physical key equivalent
assert_eq!(EguiKey::Colon.to_key(), None);