Skip to main content

Key

Enum Key 

Source
pub enum Key {
Show 145 variants ArrowDown, ArrowLeft, ArrowRight, ArrowUp, Escape, Tab, Backspace, Enter, Space, Insert, Delete, Home, End, PageUp, PageDown, Copy, Cut, Paste, Colon, Comma, Backslash, Slash, Pipe, Questionmark, Exclamationmark, OpenBracket, CloseBracket, OpenCurlyBracket, CloseCurlyBracket, Backtick, Minus, Period, Plus, Equals, Semicolon, Quote, Num0, Num1, Num2, Num3, Num4, Num5, Num6, Num7, Num8, Num9, A, B, C, D, E, F, G, H, I, J, K, L, M, N, O, P, Q, R, S, T, U, V, W, X, Y, Z, F1, F2, F3, F4, F5, F6, F7, F8, F9, F10, F11, F12, F13, F14, F15, F16, F17, F18, F19, F20, F21, F22, F23, F24, F25, F26, F27, F28, F29, F30, F31, F32, F33, F34, F35, BrowserBack, BrowserForward, BrowserRefresh, BrowserSearch, BrowserHome, BrowserFavorites, BrowserStop, MediaPlayPause, MediaTrackNext, MediaTrackPrevious, MediaStop, AudioVolumeMute, AudioVolumeDown, AudioVolumeUp, LaunchMail, LaunchApp1, LaunchApp2, ShiftLeft, ShiftRight, ControlLeft, ControlRight, AltLeft, AltRight, SuperLeft, SuperRight, IntlBackslash, CapsLock, NumLock, ScrollLock, PrintScreen, Pause, Menu, Fn, Eject, Help, Power, Sleep, Clear,
}
Expand description

A logical key, independent of the physical keyboard layout.

§Example

use crisol_core::commands::Key;

Variants§

§

ArrowDown

The Down key.

§

ArrowLeft

The Left key.

§

ArrowRight

The Right key.

§

ArrowUp

The Up key.

§

Escape

The Escape key.

§

Tab

The Tab key.

§

Backspace

The Backspace key.

§

Enter

The Enter key.

§

Space

The Space key.

§

Insert

The Insert key.

§

Delete

The Delete key.

§

Home

The Home key.

§

End

The End key.

§

PageUp

The PageUp key.

§

PageDown

The PageDown key.

§

Copy

The Copy key.

§

Cut

The Cut key.

§

Paste

The Paste key.

§

Colon

The Colon key.

§

Comma

The Comma key.

§

Backslash

The Backslash key.

§

Slash

The Slash key.

§

Pipe

The Pipe key.

§

Questionmark

The Questionmark key.

§

Exclamationmark

The Exclamationmark key.

§

OpenBracket

The OpenBracket key.

§

CloseBracket

The CloseBracket key.

§

OpenCurlyBracket

The OpenCurlyBracket key.

§

CloseCurlyBracket

The CloseCurlyBracket key.

§

Backtick

The Backtick key.

§

Minus

The Minus key.

§

Period

The Period key.

§

Plus

The Plus key.

§

Equals

The Equals key.

§

Semicolon

The Semicolon key.

§

Quote

The Quote key.

§

Num0

The 0 key.

§

Num1

The 1 key.

§

Num2

The 2 key.

§

Num3

The 3 key.

§

Num4

The 4 key.

§

Num5

The 5 key.

§

Num6

The 6 key.

§

Num7

The 7 key.

§

Num8

The 8 key.

§

Num9

The 9 key.

§

A

The A key.

§

B

The B key.

§

C

The C key.

§

D

The D key.

§

E

The E key.

§

F

The F key.

§

G

The G key.

§

H

The H key.

§

I

The I key.

§

J

The J key.

§

K

The K key.

§

L

The L key.

§

M

The M key.

§

N

The N key.

§

O

The O key.

§

P

The P key.

§

Q

The Q key.

§

R

The R key.

§

S

The S key.

§

T

The T key.

§

U

The U key.

§

V

The V key.

§

W

The W key.

§

X

The X key.

§

Y

The Y key.

§

Z

The Z key.

§

F1

The F1 key.

§

F2

The F2 key.

§

F3

The F3 key.

§

F4

The F4 key.

§

F5

The F5 key.

§

F6

The F6 key.

§

F7

The F7 key.

§

F8

The F8 key.

§

F9

The F9 key.

§

F10

The F10 key.

§

F11

The F11 key.

§

F12

The F12 key.

§

F13

The F13 key.

§

F14

The F14 key.

§

F15

The F15 key.

§

F16

The F16 key.

§

F17

The F17 key.

§

F18

The F18 key.

§

F19

The F19 key.

§

F20

The F20 key.

§

F21

The F21 key.

§

F22

The F22 key.

§

F23

The F23 key.

§

F24

The F24 key.

§

F25

The F25 key.

§

F26

The F26 key.

§

F27

The F27 key.

§

F28

The F28 key.

§

F29

The F29 key.

§

F30

The F30 key.

§

F31

The F31 key.

§

F32

The F32 key.

§

F33

The F33 key.

§

F34

The F34 key.

§

F35

The F35 key.

§

BrowserBack

The BrowserBack key.

§

BrowserForward

The BrowserForward key.

§

BrowserRefresh

The BrowserRefresh key.

§

BrowserSearch

The BrowserSearch key.

§

BrowserHome

The BrowserHome key.

§

BrowserFavorites

The BrowserFavorites key.

§

BrowserStop

The BrowserStop key.

§

MediaPlayPause

The MediaPlayPause key.

§

MediaTrackNext

The MediaTrackNext key.

§

MediaTrackPrevious

The MediaTrackPrevious key.

§

MediaStop

The MediaStop key.

§

AudioVolumeMute

The AudioVolumeMute key.

§

AudioVolumeDown

The AudioVolumeDown key.

§

AudioVolumeUp

The AudioVolumeUp key.

§

LaunchMail

The LaunchMail key.

§

LaunchApp1

The LaunchApp1 key.

§

LaunchApp2

The LaunchApp2 key.

§

ShiftLeft

The ShiftLeft key.

§

ShiftRight

The ShiftRight key.

§

ControlLeft

The ControlLeft key.

§

ControlRight

The ControlRight key.

§

AltLeft

The AltLeft key.

§

AltRight

The AltRight key.

§

SuperLeft

The SuperLeft key.

§

SuperRight

The SuperRight key.

§

IntlBackslash

The IntlBackslash key.

§

CapsLock

The CapsLock key.

§

NumLock

The NumLock key.

§

ScrollLock

The ScrollLock key.

§

PrintScreen

The PrintScreen key.

§

Pause

The Pause key.

§

Menu

The Menu key.

§

Fn

The Fn key.

§

Eject

The Eject key.

§

Help

The Help key.

§

Power

The Power key.

§

Sleep

The Sleep key.

§

Clear

The Clear key.

Implementations§

Source§

impl Key

Source

pub const ALL: [Self; 145] = names::ALL

Every variant, in declaration order.

Source

pub const fn name(self) -> &'static str

The stable display name used by Display and the keybindings file.

Source

pub fn from_name(text: &str) -> Option<Self>

Parse a key by its display name or its Rust variant name, case-insensitively.

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, formatter: &mut Formatter<'_>) -> Result

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

impl Eq for Key

Source§

impl FromStr for Key

Source§

type Err = ParseKeyError

The associated error which can be returned from parsing.
Source§

fn from_str(text: &str) -> Result<Self, Self::Err>

Parses a string s to return a value of this type. 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: &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 Forget for Key

§

impl Freeze for Key

§

impl Move 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> Allocation for T
where T: RefUnwindSafe + Send + Sync,

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<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
where ST: ?Sized, DT: ?Sized,

Source§

impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
where ST: ?Sized, DT: ?Sized,

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<Q, K> Comparable<K> for Q
where Q: Ord + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn compare(&self, key: &K) -> Ordering

Compare self to key and return their ordering.
Source§

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

Source§

fn __clone_box(&self, _: Private) -> *mut ()

Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Compare self to key and return true if they are equal.
Source§

impl<Q, K> Equivalent<K> for Q
where Q: Eq + ?Sized, K: Borrow<Q> + ?Sized,

Source§

fn equivalent(&self, key: &K) -> bool

Checks if this value is equivalent to the given key. 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> IntoEither for T

Source§

fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
Source§

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

Source§

fn align() -> usize

The alignment necessary for the key. Must return a power of two.
Source§

fn size(&self) -> usize

The size of the key in bytes.
Source§

unsafe fn init(&self, ptr: *mut u8)

Initialize the key in the given memory location. Read more
Source§

unsafe fn get<'a>(ptr: *const u8) -> &'a T

Get a reference to the key from the given memory location. Read more
Source§

unsafe fn drop_in_place(ptr: *mut u8)

Drop the key in place. Read more
Source§

impl<T> Pointable for T

Source§

const ALIGN: usize

The alignment of pointer.
Source§

type Init = T

The type for initializers.
Source§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
Source§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
Source§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
Source§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
Source§

impl<T> Read<Exclusive, BecauseExclusive> for T
where T: ?Sized,

Source§

impl<T> ToCompactString for T
where T: Display,

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.