Skip to main content

Key

Struct Key 

Source
pub struct Key(pub u8);
Expand description

a keyboard key by its HID usage (page 0x07). the consts cover the usual keys, and Key(n) gets you any other one from 0x04 to 0xE7

Tuple Fields§

§0: u8

Implementations§

Source§

impl 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 NUM1: Key

Source

pub const NUM2: Key

Source

pub const NUM3: Key

Source

pub const NUM4: Key

Source

pub const NUM5: Key

Source

pub const NUM6: Key

Source

pub const NUM7: Key

Source

pub const NUM8: Key

Source

pub const NUM9: Key

Source

pub const NUM0: Key

Source

pub const ENTER: Key

Source

pub const ESCAPE: Key

Source

pub const BACKSPACE: Key

Source

pub const TAB: Key

Source

pub const SPACE: Key

Source

pub const MINUS: Key

Source

pub const EQUAL: Key

Source

pub const LEFT_BRACKET: Key

Source

pub const RIGHT_BRACKET: Key

Source

pub const BACKSLASH: Key

Source

pub const SEMICOLON: Key

Source

pub const APOSTROPHE: Key

Source

pub const GRAVE: Key

Source

pub const COMMA: Key

Source

pub const PERIOD: Key

Source

pub const SLASH: Key

Source

pub const CAPS_LOCK: 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 PRINT_SCREEN: Key

Source

pub const SCROLL_LOCK: Key

Source

pub const PAUSE: Key

Source

pub const INSERT: Key

Source

pub const HOME: Key

Source

pub const PAGE_UP: Key

Source

pub const DELETE: Key

Source

pub const END: Key

Source

pub const PAGE_DOWN: Key

Source

pub const RIGHT: Key

Source

pub const LEFT: Key

Source

pub const DOWN: Key

Source

pub const UP: Key

Source

pub const NUM_LOCK: Key

Source

pub const KEYPAD_DIVIDE: Key

Source

pub const KEYPAD_MULTIPLY: Key

Source

pub const KEYPAD_MINUS: Key

Source

pub const KEYPAD_PLUS: Key

Source

pub const KEYPAD_ENTER: Key

Source

pub const KEYPAD1: Key

Source

pub const KEYPAD2: Key

Source

pub const KEYPAD3: Key

Source

pub const KEYPAD4: Key

Source

pub const KEYPAD5: Key

Source

pub const KEYPAD6: Key

Source

pub const KEYPAD7: Key

Source

pub const KEYPAD8: Key

Source

pub const KEYPAD9: Key

Source

pub const KEYPAD0: Key

Source

pub const KEYPAD_PERIOD: Key

Source

pub const MENU: Key

Source

pub const LEFT_CTRL: Key

Source

pub const LEFT_SHIFT: Key

Source

pub const LEFT_ALT: Key

Source

pub const LEFT_GUI: Key

Source

pub const RIGHT_CTRL: Key

Source

pub const RIGHT_SHIFT: Key

Source

pub const RIGHT_ALT: Key

Source

pub const RIGHT_GUI: Key

Source

pub const fn is_modifier(self) -> bool

ctrl, shift, alt and gui on either side. a keyboard report keeps these in a byte of their own

Trait Implementations§

Source§

impl Clone for Key

Source§

fn clone(&self) -> Self

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for Key

Source§

impl Debug for Key

Source§

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

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

impl Display for Key

Source§

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

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

impl Eq for Key

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: &Self) -> Ordering

This method returns an Ordering between self and other. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§

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

Compares and returns the minimum of two values. Read more
1.50.0 (const: unstable) · Source§

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

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

fn clamp_to<R>(self, range: R) -> Self
where Self: Sized, R: ClampBounds<Self>,

🔬This is a nightly-only experimental API. (clamp_to)
Restrict a value to a certain range. Read more
Source§

impl PartialEq for Key

Source§

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

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

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

Inequality operator !=. Read more
Source§

impl PartialOrd for Key

Source§

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

This method returns an ordering between self and other values if one exists. Read more
1.0.0 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 (const: unstable) · 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 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 UnsafeUnpin 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, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. 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> Same for T

Source§

type Output = T

Should always be Self
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> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

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

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.