Struct Scancode

Source
pub struct Scancode(pub u16);
Expand description

A button’s scancode. Maps directly to the evdev scancodes.

A value of 0 is “reserved” (always invalid).

See https://github.com/emberian/evdev/blob/main/src/scancodes.rs#L26-L572 for reference.

[1]   [59][60][61][62]   [63][64][65][66]   [67][68][87][88]
[41][ 2][ 3][ 4][ 5][ 6][ 7][ 8][ 9][10][11][12][13][  14  ]
[ 15 ][16][17][18][19][20][21][22][23][24][25][26][27][ 43 ]
[  58  ][30][31][32][33][34][35][36][37][38][39][40][  28  ]
[   42   ][44][45][46][47][48][49][50][52][52][53][   54   ]
[29][125][56][           57           ][100][0x1d0][139][97]

Tuple Fields§

§0: u16

Implementations§

Source§

impl Scancode

Source

pub fn from_char(c: char) -> (Option<Self>, Self)

Source§

impl Scancode

Source

pub const NULL: Self

Source

pub const ESC: Self

Source

pub const K_1: Self

Source

pub const K_2: Self

Source

pub const K_3: Self

Source

pub const K_4: Self

Source

pub const K_5: Self

Source

pub const K_6: Self

Source

pub const K_7: Self

Source

pub const K_8: Self

Source

pub const K_9: Self

Source

pub const K_0: Self

Source

pub const MINUS: Self

Source

pub const EQUAL: Self

Source

pub const BACKSPACE: Self

Source

pub const TAB: Self

Source

pub const Q: Self

Source

pub const W: Self

Source

pub const E: Self

Source

pub const R: Self

Source

pub const T: Self

Source

pub const Y: Self

Source

pub const U: Self

Source

pub const I: Self

Source

pub const O: Self

Source

pub const P: Self

Source

pub const L_BRACE: Self

Source

pub const R_BRACE: Self

Source

pub const ENTER: Self

Source

pub const L_CTRL: Self

Source

pub const A: Self

Source

pub const S: Self

Source

pub const D: Self

Source

pub const F: Self

Source

pub const G: Self

Source

pub const H: Self

Source

pub const J: Self

Source

pub const K: Self

Source

pub const L: Self

Source

pub const SEMICOLON: Self

Source

pub const APOSTROPHE: Self

Source

pub const GRAVE: Self

Source

pub const L_SHIFT: Self

Source

pub const BACKSLASH: Self

Source

pub const Z: Self

Source

pub const X: Self

Source

pub const C: Self

Source

pub const V: Self

Source

pub const B: Self

Source

pub const N: Self

Source

pub const M: Self

Source

pub const COMMA: Self

Source

pub const DOT: Self

Source

pub const SLASH: Self

Source

pub const R_SHIFT: Self

Source

pub const KP_ASTERISK: Self

Source

pub const L_ALT: Self

Source

pub const SPACE: Self

Source

pub const CAPSLOCK: Self

Source

pub const F1: Self

Source

pub const F2: Self

Source

pub const F3: Self

Source

pub const F4: Self

Source

pub const F5: Self

Source

pub const F6: Self

Source

pub const F7: Self

Source

pub const F8: Self

Source

pub const F9: Self

Source

pub const F10: Self

Source

pub const R_CTRL: Self

Source

pub const R_ALT: Self

Source

pub const HOME: Self

Source

pub const UP: Self

Source

pub const PAGEUP: Self

Source

pub const LEFT: Self

Source

pub const RIGHT: Self

Source

pub const END: Self

Source

pub const DOWN: Self

Source

pub const PAGEDOWN: Self

Source

pub const INSERT: Self

Source

pub const DELETE: Self

Source

pub const SCROLLUP: Self

Source

pub const SCROLLDOWN: Self

Source

pub const LMB: Self

Source

pub const RMB: Self

Source

pub const MMB: Self

Trait Implementations§

Source§

impl Clone for Scancode

Source§

fn clone(&self) -> Scancode

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 Scancode

Source§

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

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

impl From<u16> for Scancode

Source§

fn from(value: u16) -> Self

Converts to this type from the input type.
Source§

impl Hash for Scancode

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 Scancode

Source§

fn cmp(&self, other: &Scancode) -> 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 Scancode

Source§

fn eq(&self, other: &Scancode) -> 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 Scancode

Source§

fn partial_cmp(&self, other: &Scancode) -> 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 Scancode

Source§

impl Eq for Scancode

Source§

impl StructuralPartialEq for Scancode

Auto Trait Implementations§

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.