console_lib

Struct Key

Source
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

Source

pub const SPACE: Key

Source

pub const EXCLAMATION_MARK: Key

Source

pub const QUOTATION_MARK: Key

Source

pub const NUMBER_SIGN: Key

Source

pub const DOLLAR: Key

Source

pub const PERCENT_SIGN: Key

Source

pub const AMPERSAND: Key

Source

pub const APOSTROPHE: Key

Source

pub const LEFT_PARENTHESIS: Key

Source

pub const RIGHT_PARENTHESIS: Key

Source

pub const ASTERISK: Key

Source

pub const PLUS: Key

Source

pub const COMMA: Key

Source

pub const MINUS: Key

Source

pub const DOT: Key

Source

pub const SLASH: Key

Source

pub const COLON: Key

Source

pub const SEMICOLON: Key

Source

pub const LESS_THAN_SIGN: Key

Source

pub const EQUALS_SIGN: Key

Source

pub const GREATER_THAN_SIGN: Key

Source

pub const QUESTION_MARK: Key

Source

pub const AT_SIGN: Key

Source

pub const LEFT_BRACKET: Key

Source

pub const BACKSLASH: Key

Source

pub const RIGHT_BRACKET: Key

Source

pub const CARET: Key

Source

pub const UNDERSCORE: Key

Source

pub const BACKTICK: Key

Source

pub const LEFT_CURLY_BRACKET: Key

Source

pub const VERTICAL_BAR: Key

Source

pub const RIGHT_CURLY_BRACKET: Key

Source

pub const TILDE: Key

Source

pub const DIGIT_0: Key

Source

pub const DIGIT_1: Key

Source

pub const DIGIT_2: Key

Source

pub const DIGIT_3: Key

Source

pub const DIGIT_4: Key

Source

pub const DIGIT_5: Key

Source

pub const DIGIT_6: Key

Source

pub const DIGIT_7: Key

Source

pub const DIGIT_8: Key

Source

pub const DIGIT_9: Key

Source

pub const A: Key

Source

pub const B: Key

Source

pub const C: Key

Source

pub const D: Key

Source

pub const E: Key

Source

pub const F: Key

Source

pub const G: Key

Source

pub const H: Key

Source

pub const I: Key

Source

pub const J: Key

Source

pub const K: Key

Source

pub const L: Key

Source

pub const M: Key

Source

pub const N: Key

Source

pub const O: Key

Source

pub const P: Key

Source

pub const Q: Key

Source

pub const R: Key

Source

pub const S: Key

Source

pub const T: Key

Source

pub const U: Key

Source

pub const V: Key

Source

pub const W: Key

Source

pub const X: Key

Source

pub const Y: Key

Source

pub const Z: Key

Source

pub const LEFT: Key

Source

pub const UP: Key

Source

pub const RIGHT: Key

Source

pub const DOWN: Key

Source

pub const F1: Key

Source

pub const F2: Key

Source

pub const F3: Key

Source

pub const F4: Key

Source

pub const F5: Key

Source

pub const F6: Key

Source

pub const F7: Key

Source

pub const F8: Key

Source

pub const F9: Key

Source

pub const F10: Key

Source

pub const F11: Key

Source

pub const F12: Key

Source

pub const ESC: Key

Source

pub const DELETE: Key

Source

pub const ENTER: Key

Source

pub const TAB: Key

Source§

impl Key

Source

pub fn is_arrow_key(&self) -> bool

Source

pub fn to_ascii(&self) -> Option<u8>

Converts the keycode to an ASCII character if the key represents an ASCII character.

Source

pub fn is_ascii(&self) -> bool

Source

pub fn is_numeric(&self) -> bool

Checks if a keycode is ASCII and numeric.

Source

pub fn is_alphanumeric(&self) -> bool

Checks if a keycode is ASCII and alphanumeric.

Trait Implementations§

Source§

impl Clone for Key

Source§

fn clone(&self) -> Key

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for Key

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Hash for Key

Source§

fn hash<__H: Hasher>(&self, state: &mut __H)

Feeds this value into the given Hasher. Read more
1.3.0 · Source§

fn hash_slice<H>(data: &[Self], state: &mut H)
where H: Hasher, Self: Sized,

Feeds a slice of this type into the given Hasher. Read more
Source§

impl Ord for Key

Source§

fn cmp(&self, other: &Key) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 · Source§

fn max(self, other: Self) -> Self
where Self: Sized,

Compares and returns the maximum of two values. Read more
1.21.0 · Source§

fn min(self, other: Self) -> Self
where Self: Sized,

Compares and returns the minimum of two values. Read more
1.50.0 · Source§

fn clamp(self, min: Self, max: Self) -> Self
where Self: Sized,

Restrict a value to a certain interval. Read more
Source§

impl PartialEq for Key

Source§

fn eq(&self, other: &Key) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0 · Source§

fn ne(&self, other: &Rhs) -> bool

Tests for !=. The default implementation is almost always sufficient, and should not be overridden without very good reason.
Source§

impl PartialOrd for Key

Source§

fn partial_cmp(&self, other: &Key) -> Option<Ordering>

This method returns an ordering between self and other values if one exists. Read more
1.0.0 · Source§

fn lt(&self, other: &Rhs) -> bool

Tests less than (for self and other) and is used by the < operator. Read more
1.0.0 · Source§

fn le(&self, other: &Rhs) -> bool

Tests less than or equal to (for self and other) and is used by the <= operator. Read more
1.0.0 · Source§

fn gt(&self, other: &Rhs) -> bool

Tests greater than (for self and other) and is used by the > operator. Read more
1.0.0 · Source§

fn ge(&self, other: &Rhs) -> bool

Tests greater than or equal to (for self and other) and is used by the >= operator. Read more
Source§

impl Copy for Key

Source§

impl Eq for Key

Source§

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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dst: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dst. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.