pub trait IcedKeyExt: Sealed {
// Required method
fn to_key(&self) -> Option<Key>;
}Expand description
Convert an iced physical key type to a kbd Key.
Returns None for keys that have no kbd equivalent (e.g.,
Unidentified, keys beyond F24, international input keys).
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 iced key to a kbd Key, or None if unmappable.
§Examples
use iced_core::keyboard::key;
use kbd::prelude::*;
use kbd_iced::IcedKeyExt;
assert_eq!(key::Code::KeyA.to_key(), Some(Key::A));
assert_eq!(key::Code::F5.to_key(), Some(Key::F5));
let physical = key::Physical::Code(key::Code::Enter);
assert_eq!(physical.to_key(), Some(Key::ENTER));