ModifierCombination

Struct ModifierCombination 

Source
pub struct ModifierCombination(/* private fields */);
Expand description

The bit representation of the modifier combination.

Implementations§

Source§

impl ModifierCombination

Source

pub const fn new() -> Self

Creates a new default initialized bitfield.

Source

pub const fn from_bits(bits: u8) -> Self

Convert from bits.

Source

pub const fn into_bits(self) -> u8

Convert into bits.

Source

pub const fn left_ctrl(&self) -> bool

Bits: 0..1

Source

pub const fn with_left_ctrl_checked(self, value: bool) -> Result<Self, ()>

Bits: 0..1

Source

pub const fn with_left_ctrl(self, value: bool) -> Self

Bits: 0..1

Source

pub const fn set_left_ctrl(&mut self, value: bool)

Bits: 0..1

Source

pub const fn set_left_ctrl_checked(&mut self, value: bool) -> Result<(), ()>

Bits: 0..1

Source

pub const fn left_shift(&self) -> bool

Bits: 1..2

Source

pub const fn with_left_shift_checked(self, value: bool) -> Result<Self, ()>

Bits: 1..2

Source

pub const fn with_left_shift(self, value: bool) -> Self

Bits: 1..2

Source

pub const fn set_left_shift(&mut self, value: bool)

Bits: 1..2

Source

pub const fn set_left_shift_checked(&mut self, value: bool) -> Result<(), ()>

Bits: 1..2

Source

pub const fn left_alt(&self) -> bool

Bits: 2..3

Source

pub const fn with_left_alt_checked(self, value: bool) -> Result<Self, ()>

Bits: 2..3

Source

pub const fn with_left_alt(self, value: bool) -> Self

Bits: 2..3

Source

pub const fn set_left_alt(&mut self, value: bool)

Bits: 2..3

Source

pub const fn set_left_alt_checked(&mut self, value: bool) -> Result<(), ()>

Bits: 2..3

Source

pub const fn left_gui(&self) -> bool

Bits: 3..4

Source

pub const fn with_left_gui_checked(self, value: bool) -> Result<Self, ()>

Bits: 3..4

Source

pub const fn with_left_gui(self, value: bool) -> Self

Bits: 3..4

Source

pub const fn set_left_gui(&mut self, value: bool)

Bits: 3..4

Source

pub const fn set_left_gui_checked(&mut self, value: bool) -> Result<(), ()>

Bits: 3..4

Source

pub const fn right_ctrl(&self) -> bool

Bits: 4..5

Source

pub const fn with_right_ctrl_checked(self, value: bool) -> Result<Self, ()>

Bits: 4..5

Source

pub const fn with_right_ctrl(self, value: bool) -> Self

Bits: 4..5

Source

pub const fn set_right_ctrl(&mut self, value: bool)

Bits: 4..5

Source

pub const fn set_right_ctrl_checked(&mut self, value: bool) -> Result<(), ()>

Bits: 4..5

Source

pub const fn right_shift(&self) -> bool

Bits: 5..6

Source

pub const fn with_right_shift_checked(self, value: bool) -> Result<Self, ()>

Bits: 5..6

Source

pub const fn with_right_shift(self, value: bool) -> Self

Bits: 5..6

Source

pub const fn set_right_shift(&mut self, value: bool)

Bits: 5..6

Source

pub const fn set_right_shift_checked(&mut self, value: bool) -> Result<(), ()>

Bits: 5..6

Source

pub const fn right_alt(&self) -> bool

Bits: 6..7

Source

pub const fn with_right_alt_checked(self, value: bool) -> Result<Self, ()>

Bits: 6..7

Source

pub const fn with_right_alt(self, value: bool) -> Self

Bits: 6..7

Source

pub const fn set_right_alt(&mut self, value: bool)

Bits: 6..7

Source

pub const fn set_right_alt_checked(&mut self, value: bool) -> Result<(), ()>

Bits: 6..7

Source

pub const fn right_gui(&self) -> bool

Bits: 7..8

Source

pub const fn with_right_gui_checked(self, value: bool) -> Result<Self, ()>

Bits: 7..8

Source

pub const fn with_right_gui(self, value: bool) -> Self

Bits: 7..8

Source

pub const fn set_right_gui(&mut self, value: bool)

Bits: 7..8

Source

pub const fn set_right_gui_checked(&mut self, value: bool) -> Result<(), ()>

Bits: 7..8

Source§

impl ModifierCombination

Source

pub const LCTRL: Self

Source

pub const LSHIFT: Self

Source

pub const LALT: Self

Source

pub const LGUI: Self

Source

pub const RCTRL: Self

Source

pub const RSHIFT: Self

Source

pub const RALT: Self

Source

pub const RGUI: Self

Source

pub const fn new_from( right: bool, gui: bool, alt: bool, shift: bool, ctrl: bool, ) -> Self

Source

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

Source

pub const fn into_packed_bits(self) -> u8

Convert current modifier into packed bits:

bit4bit3bit2bit1bit0
L/RGUIALTSHIFTCTRL

WARN: Since the packed version cannot represent the state that BOTH left and right modifier is present, the left side has higher priority

Source

pub const fn from_packed_bits(bits: u8) -> Self

Convert packed bits back into ModifierCombination:

bit4bit3bit2bit1bit0
L/RGUIALTSHIFTCTRL

If bit4 is 0, modifiers are applied to left side, otherwise right side

Trait Implementations§

Source§

impl BitAnd for ModifierCombination

Source§

type Output = ModifierCombination

The resulting type after applying the & operator.
Source§

fn bitand(self, rhs: Self) -> Self::Output

Performs the & operation. Read more
Source§

impl BitAndAssign for ModifierCombination

Source§

fn bitand_assign(&mut self, rhs: Self)

Performs the &= operation. Read more
Source§

impl BitOr for ModifierCombination

Source§

type Output = ModifierCombination

The resulting type after applying the | operator.
Source§

fn bitor(self, rhs: Self) -> Self::Output

Performs the | operation. Read more
Source§

impl BitOrAssign for ModifierCombination

Source§

fn bitor_assign(&mut self, rhs: Self)

Performs the |= operation. Read more
Source§

impl Clone for ModifierCombination

Source§

fn clone(&self) -> ModifierCombination

Returns a duplicate of the value. Read more
1.0.0§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for ModifierCombination

Source§

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

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

impl Default for ModifierCombination

Source§

fn default() -> Self

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

impl<'de> Deserialize<'de> for ModifierCombination

Source§

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

Source§

fn from(v: ModifierCombination) -> u8

Converts to this type from the input type.
Source§

impl From<u8> for ModifierCombination

Source§

fn from(v: u8) -> Self

Converts to this type from the input type.
Source§

impl MaxSize for ModifierCombination

Source§

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

Source§

type Output = ModifierCombination

The resulting type after applying the ! operator.
Source§

fn not(self) -> Self::Output

Performs the unary ! operation. Read more
Source§

impl PartialEq for ModifierCombination

Source§

fn eq(&self, other: &ModifierCombination) -> bool

Tests for self and other values to be equal, and is used by ==.
1.0.0§

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 Serialize for ModifierCombination

Source§

fn serialize<__S>(&self, __serializer: __S) -> Result<__S::Ok, __S::Error>
where __S: Serializer,

Serialize this value into the given Serde serializer. Read more
Source§

impl Copy for ModifierCombination

Source§

impl Eq for ModifierCombination

Source§

impl StructuralPartialEq for ModifierCombination

Auto Trait Implementations§

Blanket Implementations§

§

impl<T> Any for T
where T: 'static + ?Sized,

§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T> Borrow<T> for T
where T: ?Sized,

§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
§

impl<T> BorrowMut<T> for T
where T: ?Sized,

§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> CloneToUninit for T
where T: Clone,

§

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
§

impl<T> From<T> for T

§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<T, U> Into<U> for T
where U: From<T>,

§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<T> DeserializeOwned for T
where T: for<'de> Deserialize<'de>,