pub struct ModifierIndex(/* private fields */);Expand description
A modifier index.
This is a number between 0 and 31 that indicates a bit in a modifier mask.
See the documentation of ModifierMask for possible meanings of the indices.
Implementations§
Source§impl ModifierIndex
impl ModifierIndex
Sourcepub const ALT: Self
pub const ALT: Self
This is an alias for Self::MOD1.
This association exists by convention and is hard-coded in xkbcommon.
Sourcepub const NUM_LOCK: Self
pub const NUM_LOCK: Self
This is an alias for Self::MOD2.
This association exists by convention and is hard-coded in xkbcommon.
Sourcepub const SUPER: Self
pub const SUPER: Self
This is an alias for Self::MOD4.
This association exists by convention and is hard-coded in xkbcommon.
Sourcepub const fn new(index: u32) -> Option<Self>
pub const fn new(index: u32) -> Option<Self>
Creates a new ModifierIndex.
Returns None if the index is larger than 31.
Sourcepub const fn raw(self) -> u32
pub const fn raw(self) -> u32
Returns the numeric index.
This value is guaranteed to be less than 32.
Sourcepub const fn to_mask(self) -> ModifierMask
pub const fn to_mask(self) -> ModifierMask
Returns the mask corresponding to this index.
assert_eq!(ModifierIndex::SHIFT.to_mask(), ModifierMask::SHIFT);Trait Implementations§
Source§impl Clone for ModifierIndex
impl Clone for ModifierIndex
Source§fn clone(&self) -> ModifierIndex
fn clone(&self) -> ModifierIndex
Returns a copy of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModifierIndex
impl Debug for ModifierIndex
Source§impl Hash for ModifierIndex
impl Hash for ModifierIndex
Source§impl Ord for ModifierIndex
impl Ord for ModifierIndex
Source§fn cmp(&self, other: &ModifierIndex) -> Ordering
fn cmp(&self, other: &ModifierIndex) -> Ordering
1.21.0 · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
Source§impl PartialEq for ModifierIndex
impl PartialEq for ModifierIndex
Source§impl PartialOrd for ModifierIndex
impl PartialOrd for ModifierIndex
impl Copy for ModifierIndex
impl Eq for ModifierIndex
impl StructuralPartialEq for ModifierIndex
Auto Trait Implementations§
impl Freeze for ModifierIndex
impl RefUnwindSafe for ModifierIndex
impl Send for ModifierIndex
impl Sync for ModifierIndex
impl Unpin for ModifierIndex
impl UnwindSafe for ModifierIndex
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
Compare self to
key and return true if they are equal.