Skip to main content

Keysym

Struct Keysym 

Source
pub struct Keysym(pub u32);
Expand description

A layout-mapped key symbol, in the X11/XKB keysym numbering.

See the module docs for why that numbering. The values a game actually wants are usually reachable through Keysym::to_char; the raw number matters only for named function keys, which live above 0xFF00.

Tuple Fields§

§0: u32

Implementations§

Source§

impl Keysym

Source

pub const NONE: Self

No symbol — a key that produces nothing in the current layout, or a backend that could not map one. XKB_KEY_NoSymbol.

Source

pub const BACKSPACE: Self

XK_BackSpace.

Source

pub const TAB: Self

XK_Tab.

Source

pub const RETURN: Self

XK_Return.

Source

pub const PAUSE: Self

XK_Pause.

Source

pub const SCROLL_LOCK: Self

XK_Scroll_Lock.

Source

pub const ESCAPE: Self

XK_Escape.

Source

pub const HOME: Self

XK_Home.

Source

pub const LEFT: Self

XK_Left.

Source

pub const UP: Self

XK_Up.

Source

pub const RIGHT: Self

XK_Right.

Source

pub const DOWN: Self

XK_Down.

Source

pub const PAGE_UP: Self

XK_Prior.

Source

pub const PAGE_DOWN: Self

XK_Next.

Source

pub const END: Self

XK_End.

Source

pub const PRINT: Self

XK_Print.

Source

pub const INSERT: Self

XK_Insert.

Source

pub const MENU: Self

XK_Menu.

Source

pub const NUM_LOCK: Self

XK_Num_Lock.

Source

pub const KP_ENTER: Self

XK_KP_Enter.

Source

pub const KP_MULTIPLY: Self

XK_KP_Multiply.

Source

pub const KP_ADD: Self

XK_KP_Add.

Source

pub const KP_SUBTRACT: Self

XK_KP_Subtract.

Source

pub const KP_DECIMAL: Self

XK_KP_Decimal.

Source

pub const KP_DIVIDE: Self

XK_KP_Divide.

Source

pub const KP_0: Self

XK_KP_0.

Source

pub const KP_1: Self

XK_KP_1.

Source

pub const KP_2: Self

XK_KP_2.

Source

pub const KP_3: Self

XK_KP_3.

Source

pub const KP_4: Self

XK_KP_4.

Source

pub const KP_5: Self

XK_KP_5.

Source

pub const KP_6: Self

XK_KP_6.

Source

pub const KP_7: Self

XK_KP_7.

Source

pub const KP_8: Self

XK_KP_8.

Source

pub const KP_9: Self

XK_KP_9.

Source

pub const F1: Self

XK_F1.

Source

pub const F2: Self

XK_F2.

Source

pub const F3: Self

XK_F3.

Source

pub const F4: Self

XK_F4.

Source

pub const F5: Self

XK_F5.

Source

pub const F6: Self

XK_F6.

Source

pub const F7: Self

XK_F7.

Source

pub const F8: Self

XK_F8.

Source

pub const F9: Self

XK_F9.

Source

pub const F10: Self

XK_F10.

Source

pub const F11: Self

XK_F11.

Source

pub const F12: Self

XK_F12.

Source

pub const SHIFT_L: Self

XK_Shift_L.

Source

pub const SHIFT_R: Self

XK_Shift_R.

Source

pub const CONTROL_L: Self

XK_Control_L.

Source

pub const CONTROL_R: Self

XK_Control_R.

Source

pub const CAPS_LOCK: Self

XK_Caps_Lock.

Source

pub const ALT_L: Self

XK_Alt_L.

Source

pub const ALT_R: Self

XK_Alt_R.

Source

pub const SUPER_L: Self

XK_Super_L.

Source

pub const SUPER_R: Self

XK_Super_R.

Source

pub const DELETE: Self

XK_Delete.

Source

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

The character this symbol produces, if it produces one.

Implements the two rules XKB uses: keysyms 0x20..=0x7E and 0xA0..=0xFF are Latin-1 directly, and everything else that maps to a character is 0x0100_0000 | codepoint. Function keys, modifiers and dead keys return None.

This deliberately does not cover the several hundred legacy non-Latin-1 keysyms that predate the Unicode block (Greek, Cyrillic and friends in 0x05xx–0x07xx). Text input is delivered as committed strings, not reconstructed from keysyms, so the table would exist only to be wrong in a way nobody notices; a shortcut label falls back to the KeyCode name.

Source

pub const fn from_char(character: char) -> Self

The keysym for a character, in the canonical form XKB produces.

Source

pub const fn is_none(self) -> bool

Whether this is Keysym::NONE.

Trait Implementations§

Source§

impl Clone for Keysym

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 Keysym

Source§

impl Debug for Keysym

Source§

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

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

impl Default for Keysym

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl Display for Keysym

Source§

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

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

impl Eq for Keysym

Source§

impl Hash for Keysym

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 Keysym

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 Keysym

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 Keysym

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 Keysym

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> 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.