pub struct Key(/* private fields */);
Expand description
A representation of a key code from the console lib binding.
The key should be checked with the constants provided in the Key implementation (Like Key::SPACE).
Unknown keys map to undefined values.
Implementations§
Source§impl Key
impl Key
pub const SPACE: Key
pub const EXCLAMATION_MARK: Key
pub const QUOTATION_MARK: Key
pub const NUMBER_SIGN: Key
pub const DOLLAR: Key
pub const PERCENT_SIGN: Key
pub const AMPERSAND: Key
pub const APOSTROPHE: Key
pub const LEFT_PARENTHESIS: Key
pub const RIGHT_PARENTHESIS: Key
pub const ASTERISK: Key
pub const PLUS: Key
pub const COMMA: Key
pub const MINUS: Key
pub const DOT: Key
pub const SLASH: Key
pub const COLON: Key
pub const SEMICOLON: Key
pub const LESS_THAN_SIGN: Key
pub const EQUALS_SIGN: Key
pub const GREATER_THAN_SIGN: Key
pub const QUESTION_MARK: Key
pub const AT_SIGN: Key
pub const LEFT_BRACKET: Key
pub const BACKSLASH: Key
pub const RIGHT_BRACKET: Key
pub const CARET: Key
pub const UNDERSCORE: Key
pub const BACKTICK: Key
pub const LEFT_CURLY_BRACKET: Key
pub const VERTICAL_BAR: Key
pub const RIGHT_CURLY_BRACKET: Key
pub const TILDE: Key
pub const DIGIT_0: Key
pub const DIGIT_1: Key
pub const DIGIT_2: Key
pub const DIGIT_3: Key
pub const DIGIT_4: Key
pub const DIGIT_5: Key
pub const DIGIT_6: Key
pub const DIGIT_7: Key
pub const DIGIT_8: Key
pub const DIGIT_9: Key
pub const A: Key
pub const B: Key
pub const C: Key
pub const D: Key
pub const E: Key
pub const F: Key
pub const G: Key
pub const H: Key
pub const I: Key
pub const J: Key
pub const K: Key
pub const L: Key
pub const M: Key
pub const N: Key
pub const O: Key
pub const P: Key
pub const Q: Key
pub const R: Key
pub const S: Key
pub const T: Key
pub const U: Key
pub const V: Key
pub const W: Key
pub const X: Key
pub const Y: Key
pub const Z: Key
pub const LEFT: Key
pub const UP: Key
pub const RIGHT: Key
pub const DOWN: Key
pub const F1: Key
pub const F2: Key
pub const F3: Key
pub const F4: Key
pub const F5: Key
pub const F6: Key
pub const F7: Key
pub const F8: Key
pub const F9: Key
pub const F10: Key
pub const F11: Key
pub const F12: Key
pub const ESC: Key
pub const DELETE: Key
pub const ENTER: Key
pub const TAB: Key
Source§impl Key
impl Key
pub fn is_arrow_key(&self) -> bool
Sourcepub fn to_ascii(&self) -> Option<u8>
pub fn to_ascii(&self) -> Option<u8>
Converts the keycode to an ASCII character if the key represents an ASCII character.
pub fn is_ascii(&self) -> bool
Sourcepub fn is_numeric(&self) -> bool
pub fn is_numeric(&self) -> bool
Checks if a keycode is ASCII and numeric.
Sourcepub fn is_alphanumeric(&self) -> bool
pub fn is_alphanumeric(&self) -> bool
Checks if a keycode is ASCII and alphanumeric.
Trait Implementations§
Source§impl Ord for Key
impl Ord for Key
Source§impl PartialOrd for Key
impl PartialOrd for Key
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