Struct Key

Source
pub struct Key { /* private fields */ }
Expand description

Defines the inputted virtual keycode

Implementations§

Source§

impl Key

Source

pub const None: Key

None

Source

pub const Button: Key

Button

Source

pub const BackSpace: Key

BackSpace

Source

pub const Tab: Key

Tab

Source

pub const IsoKey: Key

IsoKey

Source

pub const Enter: Key

Enter

Source

pub const Pause: Key

Pause

Source

pub const ScrollLock: Key

ScrollLock

Source

pub const Escape: Key

Escape

Source

pub const Kana: Key

Kana

Source

pub const Eisu: Key

Eisu

Source

pub const Yen: Key

Yen

Source

pub const JISUnderscore: Key

JISUnderscore

Source

pub const Home: Key

Home

Source

pub const Left: Key

Left

Source

pub const Up: Key

Up

Source

pub const Right: Key

Right

Source

pub const Down: Key

Down

Source

pub const PageUp: Key

PageUp

Source

pub const PageDown: Key

PageDown

Source

pub const End: Key

End

Source

pub const Print: Key

Print

Source

pub const Insert: Key

Insert

Source

pub const Menu: Key

Menu

Source

pub const Help: Key

Help

Source

pub const NumLock: Key

NumLock

Source

pub const KP: Key

Keypad

Source

pub const KPEnter: Key

Keypad Enter

Source

pub const KPLast: Key

Keypad Last

Source

pub const F1: Key

F1

Source

pub const F2: Key

F2

Source

pub const F3: Key

F3

Source

pub const F4: Key

F4

Source

pub const F5: Key

F5

Source

pub const F6: Key

F6

Source

pub const F7: Key

F7

Source

pub const F8: Key

F8

Source

pub const F9: Key

F9

Source

pub const F10: Key

F10

Source

pub const F11: Key

F11

Source

pub const F12: Key

F12

Source

pub const FLast: Key

Function key last

Source

pub const ShiftL: Key

Shift Left

Source

pub const ShiftR: Key

Shift Right

Source

pub const ControlL: Key

Control Left

Source

pub const ControlR: Key

Control Right

Source

pub const CapsLock: Key

Caps Lock

Source

pub const MetaL: Key

Meta Left

Source

pub const MetaR: Key

Meta Right

Source

pub const AltL: Key

Alt Left

Source

pub const AltR: Key

Alt Right

Source

pub const Delete: Key

Delete

Source

pub const fn bits(&self) -> i32

Gets the i32 value of a Key

Source

pub const fn from_i32(val: i32) -> Key

Gets a Key from an i32

Source

pub const fn from_char(val: char) -> Key

Gets a Key from a char

Examples found in repository?
examples/pong.rs (line 5)
5const KEY_A: Key = Key::from_char('a');
6const KEY_D: Key = Key::from_char('d');
Source

pub const fn to_char(&self) -> Option<char>

Get the char representation of a Key.

Source

pub const fn is_fn_key(key: Key) -> bool

Returns whether a key is a function key

Source

pub const fn fn_key(val: i32) -> Key

Return the corresponding function key

Trait Implementations§

Source§

impl BitOr<Key> for Shortcut

Source§

type Output = Shortcut

The resulting type after applying the | operator.
Source§

fn bitor(self, other: Key) -> Self::Output

Performs the | operation. Read more
Source§

impl Clone for Key

Source§

fn clone(&self) -> Key

Returns a duplicate 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, 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> 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.