pub struct Key {
pub code: KeyCode,
pub mods: Option<KeyMod>,
}
Expand description
Struct representing a Key composed of a KeyCode and KeyMod Note that certain KeyCode + KeyMod combinations are not supported:
- KeyMod::AltCtrlShift and KeyCode::Char(
), e.g. KeyCode::Char(‘h’) will report Key { code: Char(’h), mods: KeyMod::CtrlAlt despite the shift key being pressed due to limitations in the terminal API - KeyMod::AltCtrl and KeyCode::Char(0..=9) are not supported.
- KeyMod::CtrlShift and KeyCode::Char(0..=9) are not supported
- Any modifier keys and Backspace/Tab are not supported, save KeyMod::Shift and KeyCode::Tab which is KeyCode::BackTab
- Shift+Insert is not supported
- Some terminals do not support modifier keys and certain non alpha-numeric keys
Fields§
§code: KeyCode
any key that could be pressed
mods: Option<KeyMod>
any key modifier ctrl + alt + shift (excluding capital letters w/ shift) that could be pressed.
Implementations§
Trait Implementations§
impl Copy 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