pub struct ModifierCombination(/* private fields */);Expand description
The bit representation of the modifier combination.
Implementations§
Source§impl ModifierCombination
impl ModifierCombination
Sourcepub const fn with_left_ctrl_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_left_ctrl_checked(self, value: bool) -> Result<Self, ()>
Bits: 0..1
Sourcepub const fn with_left_ctrl(self, value: bool) -> Self
pub const fn with_left_ctrl(self, value: bool) -> Self
Bits: 0..1
Sourcepub const fn set_left_ctrl(&mut self, value: bool)
pub const fn set_left_ctrl(&mut self, value: bool)
Bits: 0..1
Sourcepub const fn left_shift(&self) -> bool
pub const fn left_shift(&self) -> bool
Bits: 1..2
Sourcepub const fn with_left_shift_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_left_shift_checked(self, value: bool) -> Result<Self, ()>
Bits: 1..2
Sourcepub const fn with_left_shift(self, value: bool) -> Self
pub const fn with_left_shift(self, value: bool) -> Self
Bits: 1..2
Sourcepub const fn set_left_shift(&mut self, value: bool)
pub const fn set_left_shift(&mut self, value: bool)
Bits: 1..2
Sourcepub const fn with_left_alt_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_left_alt_checked(self, value: bool) -> Result<Self, ()>
Bits: 2..3
Sourcepub const fn with_left_alt(self, value: bool) -> Self
pub const fn with_left_alt(self, value: bool) -> Self
Bits: 2..3
Sourcepub const fn set_left_alt(&mut self, value: bool)
pub const fn set_left_alt(&mut self, value: bool)
Bits: 2..3
Sourcepub const fn with_left_gui_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_left_gui_checked(self, value: bool) -> Result<Self, ()>
Bits: 3..4
Sourcepub const fn with_left_gui(self, value: bool) -> Self
pub const fn with_left_gui(self, value: bool) -> Self
Bits: 3..4
Sourcepub const fn set_left_gui(&mut self, value: bool)
pub const fn set_left_gui(&mut self, value: bool)
Bits: 3..4
Sourcepub const fn right_ctrl(&self) -> bool
pub const fn right_ctrl(&self) -> bool
Bits: 4..5
Sourcepub const fn with_right_ctrl_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_right_ctrl_checked(self, value: bool) -> Result<Self, ()>
Bits: 4..5
Sourcepub const fn with_right_ctrl(self, value: bool) -> Self
pub const fn with_right_ctrl(self, value: bool) -> Self
Bits: 4..5
Sourcepub const fn set_right_ctrl(&mut self, value: bool)
pub const fn set_right_ctrl(&mut self, value: bool)
Bits: 4..5
Sourcepub const fn right_shift(&self) -> bool
pub const fn right_shift(&self) -> bool
Bits: 5..6
Sourcepub const fn with_right_shift_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_right_shift_checked(self, value: bool) -> Result<Self, ()>
Bits: 5..6
Sourcepub const fn with_right_shift(self, value: bool) -> Self
pub const fn with_right_shift(self, value: bool) -> Self
Bits: 5..6
Sourcepub const fn set_right_shift(&mut self, value: bool)
pub const fn set_right_shift(&mut self, value: bool)
Bits: 5..6
Sourcepub const fn with_right_alt_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_right_alt_checked(self, value: bool) -> Result<Self, ()>
Bits: 6..7
Sourcepub const fn with_right_alt(self, value: bool) -> Self
pub const fn with_right_alt(self, value: bool) -> Self
Bits: 6..7
Sourcepub const fn set_right_alt(&mut self, value: bool)
pub const fn set_right_alt(&mut self, value: bool)
Bits: 6..7
Sourcepub const fn with_right_gui_checked(self, value: bool) -> Result<Self, ()>
pub const fn with_right_gui_checked(self, value: bool) -> Result<Self, ()>
Bits: 7..8
Sourcepub const fn with_right_gui(self, value: bool) -> Self
pub const fn with_right_gui(self, value: bool) -> Self
Bits: 7..8
Sourcepub const fn set_right_gui(&mut self, value: bool)
pub const fn set_right_gui(&mut self, value: bool)
Bits: 7..8
Source§impl ModifierCombination
impl ModifierCombination
pub const LCTRL: Self
pub const LSHIFT: Self
pub const LALT: Self
pub const LGUI: Self
pub const RCTRL: Self
pub const RSHIFT: Self
pub const RALT: Self
pub const RGUI: Self
pub const fn new_from( right: bool, gui: bool, alt: bool, shift: bool, ctrl: bool, ) -> Self
pub const fn new_from_vals( left_ctrl: bool, left_shift: bool, left_alt: bool, left_gui: bool, right_ctrl: bool, right_shift: bool, right_alt: bool, right_gui: bool, ) -> Self
Sourcepub const fn into_packed_bits(self) -> u8
pub const fn into_packed_bits(self) -> u8
Convert current modifier into packed bits:
| bit4 | bit3 | bit2 | bit1 | bit0 |
|---|---|---|---|---|
| L/R | GUI | ALT | SHIFT | CTRL |
WARN: Since the packed version cannot represent the state that BOTH left and right modifier is present, the left side has higher priority
Sourcepub const fn from_packed_bits(bits: u8) -> Self
pub const fn from_packed_bits(bits: u8) -> Self
Convert packed bits back into ModifierCombination:
| bit4 | bit3 | bit2 | bit1 | bit0 |
|---|---|---|---|---|
| L/R | GUI | ALT | SHIFT | CTRL |
If bit4 is 0, modifiers are applied to left side, otherwise right side
Trait Implementations§
Source§impl BitAnd for ModifierCombination
impl BitAnd for ModifierCombination
Source§impl BitAndAssign for ModifierCombination
impl BitAndAssign for ModifierCombination
Source§fn bitand_assign(&mut self, rhs: Self)
fn bitand_assign(&mut self, rhs: Self)
Performs the
&= operation. Read moreSource§impl BitOr for ModifierCombination
impl BitOr for ModifierCombination
Source§impl BitOrAssign for ModifierCombination
impl BitOrAssign for ModifierCombination
Source§fn bitor_assign(&mut self, rhs: Self)
fn bitor_assign(&mut self, rhs: Self)
Performs the
|= operation. Read moreSource§impl Clone for ModifierCombination
impl Clone for ModifierCombination
Source§fn clone(&self) -> ModifierCombination
fn clone(&self) -> ModifierCombination
Returns a duplicate of the value. Read more
1.0.0§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for ModifierCombination
impl Debug for ModifierCombination
Source§impl Default for ModifierCombination
impl Default for ModifierCombination
Source§impl<'de> Deserialize<'de> for ModifierCombination
impl<'de> Deserialize<'de> for ModifierCombination
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<ModifierCombination> for u8
impl From<ModifierCombination> for u8
Source§fn from(v: ModifierCombination) -> u8
fn from(v: ModifierCombination) -> u8
Converts to this type from the input type.
Source§impl From<u8> for ModifierCombination
impl From<u8> for ModifierCombination
Source§impl MaxSize for ModifierCombination
impl MaxSize for ModifierCombination
Source§const POSTCARD_MAX_SIZE: usize = 1usize
const POSTCARD_MAX_SIZE: usize = 1usize
The maximum possible size that the serialization of this
type can have, in bytes.
Source§impl Not for ModifierCombination
impl Not for ModifierCombination
Source§impl PartialEq for ModifierCombination
impl PartialEq for ModifierCombination
Source§impl Serialize for ModifierCombination
impl Serialize for ModifierCombination
impl Copy for ModifierCombination
impl Eq for ModifierCombination
impl StructuralPartialEq for ModifierCombination
Auto Trait Implementations§
impl Freeze for ModifierCombination
impl RefUnwindSafe for ModifierCombination
impl Send for ModifierCombination
impl Sync for ModifierCombination
impl Unpin for ModifierCombination
impl UnwindSafe for ModifierCombination
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§unsafe fn clone_to_uninit(&self, dest: *mut u8)
unsafe fn clone_to_uninit(&self, dest: *mut u8)
🔬This is a nightly-only experimental API. (
clone_to_uninit)