Skip to main content

Keysym

Struct Keysym 

Source
pub struct Keysym(pub u32);
Expand description

Input vocabulary, defined in crcbl_core::input and re-exported so a consumer of the event stream needs one use rather than two.

See the crate docs for why these live in crcbl-core. 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: Keysym

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: Keysym

XK_BackSpace.

Source

pub const TAB: Keysym

XK_Tab.

Source

pub const RETURN: Keysym

XK_Return.

Source

pub const PAUSE: Keysym

XK_Pause.

Source

pub const SCROLL_LOCK: Keysym

XK_Scroll_Lock.

Source

pub const ESCAPE: Keysym

XK_Escape.

Source

pub const HOME: Keysym

XK_Home.

Source

pub const LEFT: Keysym

XK_Left.

Source

pub const UP: Keysym

XK_Up.

Source

pub const RIGHT: Keysym

XK_Right.

Source

pub const DOWN: Keysym

XK_Down.

Source

pub const PAGE_UP: Keysym

XK_Prior.

Source

pub const PAGE_DOWN: Keysym

XK_Next.

Source

pub const END: Keysym

XK_End.

Source

pub const PRINT: Keysym

XK_Print.

Source

pub const INSERT: Keysym

XK_Insert.

Source

pub const MENU: Keysym

XK_Menu.

Source

pub const NUM_LOCK: Keysym

XK_Num_Lock.

Source

pub const KP_ENTER: Keysym

XK_KP_Enter.

Source

pub const KP_MULTIPLY: Keysym

XK_KP_Multiply.

Source

pub const KP_ADD: Keysym

XK_KP_Add.

Source

pub const KP_SUBTRACT: Keysym

XK_KP_Subtract.

Source

pub const KP_DECIMAL: Keysym

XK_KP_Decimal.

Source

pub const KP_DIVIDE: Keysym

XK_KP_Divide.

Source

pub const KP_0: Keysym

XK_KP_0.

Source

pub const KP_1: Keysym

XK_KP_1.

Source

pub const KP_2: Keysym

XK_KP_2.

Source

pub const KP_3: Keysym

XK_KP_3.

Source

pub const KP_4: Keysym

XK_KP_4.

Source

pub const KP_5: Keysym

XK_KP_5.

Source

pub const KP_6: Keysym

XK_KP_6.

Source

pub const KP_7: Keysym

XK_KP_7.

Source

pub const KP_8: Keysym

XK_KP_8.

Source

pub const KP_9: Keysym

XK_KP_9.

Source

pub const F1: Keysym

XK_F1.

Source

pub const F2: Keysym

XK_F2.

Source

pub const F3: Keysym

XK_F3.

Source

pub const F4: Keysym

XK_F4.

Source

pub const F5: Keysym

XK_F5.

Source

pub const F6: Keysym

XK_F6.

Source

pub const F7: Keysym

XK_F7.

Source

pub const F8: Keysym

XK_F8.

Source

pub const F9: Keysym

XK_F9.

Source

pub const F10: Keysym

XK_F10.

Source

pub const F11: Keysym

XK_F11.

Source

pub const F12: Keysym

XK_F12.

Source

pub const SHIFT_L: Keysym

XK_Shift_L.

Source

pub const SHIFT_R: Keysym

XK_Shift_R.

Source

pub const CONTROL_L: Keysym

XK_Control_L.

Source

pub const CONTROL_R: Keysym

XK_Control_R.

Source

pub const CAPS_LOCK: Keysym

XK_Caps_Lock.

Source

pub const ALT_L: Keysym

XK_Alt_L.

Source

pub const ALT_R: Keysym

XK_Alt_R.

Source

pub const SUPER_L: Keysym

XK_Super_L.

Source

pub const SUPER_R: Keysym

XK_Super_R.

Source

pub const DELETE: Keysym

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) -> Keysym

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) -> Keysym

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<(), Error>

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

impl Default for Keysym

Source§

fn default() -> Keysym

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

impl Display for Keysym

Source§

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

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

impl Eq for Keysym

Source§

impl Hash for Keysym

Source§

fn hash<__H>(&self, state: &mut __H)
where __H: Hasher,

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: &Keysym) -> 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: &Keysym) -> 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: &Keysym) -> 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.