pub enum Key {
Character(String),
Named(NamedKey),
}
Expand description
The value received from the keypress.
Variants§
Character(String)
A key string that corresponds to the character typed by the user, taking into account the user’s current locale setting, modifier state, and any system-level keyboard mapping overrides that are in effect.
Named(NamedKey)
Implementations§
Source§impl Key
impl Key
Sourcepub fn legacy_charcode(&self) -> u32
pub fn legacy_charcode(&self) -> u32
Determine a charCode value for a key with a character value.
For all other keys the value is zero. The charCode is an implementation specific legacy property of DOM keyboard events.
Specification: https://w3c.github.io/uievents/#dom-keyboardevent-charcode
Sourcepub fn legacy_keycode(&self) -> u32
pub fn legacy_keycode(&self) -> u32
Determine a keyCode value for a key.
The keyCode is an implementation specific legacy property of DOM keyboard events.
Specification: https://w3c.github.io/uievents/#dom-keyboardevent-keycode
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Key
impl<'de> Deserialize<'de> for Key
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl Ord for Key
impl Ord for Key
Source§impl PartialOrd for Key
impl PartialOrd for Key
impl Eq for Key
impl StructuralPartialEq for Key
Auto Trait Implementations§
impl Freeze for Key
impl RefUnwindSafe for Key
impl Send for Key
impl Sync for Key
impl Unpin for Key
impl UnwindSafe for Key
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