Struct piston_window::keyboard::ModifierKey
pub struct ModifierKey { /* private fields */ }
Implementations
impl ModifierKey
impl ModifierKey
pub const NO_MODIFIER: ModifierKey = Self{ bits: 0,}
pub const NO_MODIFIER: ModifierKey = Self{ bits: 0,}
No modifier.
pub const CTRL: ModifierKey = Self{ bits: 1,}
pub const CTRL: ModifierKey = Self{ bits: 1,}
Ctrl.
pub const SHIFT: ModifierKey = Self{ bits: 2,}
pub const SHIFT: ModifierKey = Self{ bits: 2,}
Shift.
pub const ALT: ModifierKey = Self{ bits: 4,}
pub const ALT: ModifierKey = Self{ bits: 4,}
Alt.
pub const GUI: ModifierKey = Self{ bits: 8,}
pub const GUI: ModifierKey = Self{ bits: 8,}
Gui.
pub const CTRL_SHIFT: ModifierKey = Self{ bits: ModifierKey::CTRL.bits | ModifierKey::SHIFT.bits,}
pub const CTRL_SHIFT: ModifierKey = Self{ bits: ModifierKey::CTRL.bits | ModifierKey::SHIFT.bits,}
Ctrl + Shift.
pub const CTRL_ALT: ModifierKey = Self{ bits: ModifierKey::CTRL.bits | ModifierKey::ALT.bits,}
pub const CTRL_ALT: ModifierKey = Self{ bits: ModifierKey::CTRL.bits | ModifierKey::ALT.bits,}
Ctrl + Alt.
pub const CTRL_GUI: ModifierKey = Self{ bits: ModifierKey::CTRL.bits | ModifierKey::GUI.bits,}
pub const CTRL_GUI: ModifierKey = Self{ bits: ModifierKey::CTRL.bits | ModifierKey::GUI.bits,}
Ctrl + Gui.
pub const CTRL_SHIFT_ALT: ModifierKey = Self{
bits:
ModifierKey::CTRL.bits | ModifierKey::SHIFT.bits |
ModifierKey::ALT.bits,}
pub const CTRL_SHIFT_ALT: ModifierKey = Self{ bits: ModifierKey::CTRL.bits | ModifierKey::SHIFT.bits | ModifierKey::ALT.bits,}
Ctrl + Shift + Alt.
pub const CTRL_SHIFT_GUI: ModifierKey = Self{
bits:
ModifierKey::CTRL.bits | ModifierKey::SHIFT.bits |
ModifierKey::GUI.bits,}
pub const CTRL_SHIFT_GUI: ModifierKey = Self{ bits: ModifierKey::CTRL.bits | ModifierKey::SHIFT.bits | ModifierKey::GUI.bits,}
Ctrl + Shift + Gui.
pub const CTRL_SHIFT_ALT_GUI: ModifierKey = Self{
bits:
ModifierKey::CTRL.bits | ModifierKey::SHIFT.bits |
ModifierKey::ALT.bits | ModifierKey::GUI.bits,}
pub const CTRL_SHIFT_ALT_GUI: ModifierKey = Self{ bits: ModifierKey::CTRL.bits | ModifierKey::SHIFT.bits | ModifierKey::ALT.bits | ModifierKey::GUI.bits,}
Ctrl + Shift + Alt + Gui.
pub const SHIFT_ALT: ModifierKey = Self{ bits: ModifierKey::SHIFT.bits | ModifierKey::ALT.bits,}
pub const SHIFT_ALT: ModifierKey = Self{ bits: ModifierKey::SHIFT.bits | ModifierKey::ALT.bits,}
Shift + Alt.
pub const SHIFT_GUI: ModifierKey = Self{ bits: ModifierKey::SHIFT.bits | ModifierKey::GUI.bits,}
pub const SHIFT_GUI: ModifierKey = Self{ bits: ModifierKey::SHIFT.bits | ModifierKey::GUI.bits,}
Shift + Gui.
pub const SHIFT_ALT_GUI: ModifierKey = Self{
bits:
ModifierKey::SHIFT.bits | ModifierKey::ALT.bits |
ModifierKey::GUI.bits,}
pub const SHIFT_ALT_GUI: ModifierKey = Self{ bits: ModifierKey::SHIFT.bits | ModifierKey::ALT.bits | ModifierKey::GUI.bits,}
Shift + Alt + Gui.
pub const ALT_GUI: ModifierKey = Self{ bits: ModifierKey::ALT.bits | ModifierKey::GUI.bits,}
pub const ALT_GUI: ModifierKey = Self{ bits: ModifierKey::ALT.bits | ModifierKey::GUI.bits,}
Alt + Gui.
pub const fn empty() -> ModifierKey
pub const fn empty() -> ModifierKey
Returns an empty set of flags.
pub const fn all() -> ModifierKey
pub const fn all() -> ModifierKey
Returns the set containing all flags.
pub const fn from_bits(bits: u8) -> Option<ModifierKey>
pub const fn from_bits(bits: u8) -> Option<ModifierKey>
Convert from underlying bit representation, unless that representation contains bits that do not correspond to a flag.
pub const fn from_bits_truncate(bits: u8) -> ModifierKey
pub const fn from_bits_truncate(bits: u8) -> ModifierKey
Convert from underlying bit representation, dropping any bits that do not correspond to flags.
pub const unsafe fn from_bits_unchecked(bits: u8) -> ModifierKey
pub const unsafe fn from_bits_unchecked(bits: u8) -> ModifierKey
Convert from underlying bit representation, preserving all bits (even those not corresponding to a defined flag).
Safety
The caller of the bitflags!
macro can chose to allow or
disallow extra bits for their bitflags type.
The caller of from_bits_unchecked()
has to ensure that
all bits correspond to a defined flag or that extra bits
are valid for this bitflags type.
pub const fn intersects(&self, other: ModifierKey) -> bool
pub const fn intersects(&self, other: ModifierKey) -> bool
Returns true
if there are flags common to both self
and other
.
pub const fn contains(&self, other: ModifierKey) -> bool
pub const fn contains(&self, other: ModifierKey) -> bool
Returns true
if all of the flags in other
are contained within self
.
pub fn insert(&mut self, other: ModifierKey)
pub fn insert(&mut self, other: ModifierKey)
Inserts the specified flags in-place.
pub fn remove(&mut self, other: ModifierKey)
pub fn remove(&mut self, other: ModifierKey)
Removes the specified flags in-place.
pub fn toggle(&mut self, other: ModifierKey)
pub fn toggle(&mut self, other: ModifierKey)
Toggles the specified flags in-place.
pub fn set(&mut self, other: ModifierKey, value: bool)
pub fn set(&mut self, other: ModifierKey, value: bool)
Inserts or removes the specified flags depending on the passed value.
pub const fn intersection(self, other: ModifierKey) -> ModifierKey
pub const fn intersection(self, other: ModifierKey) -> ModifierKey
Returns the intersection between the flags in self
and
other
.
Specifically, the returned set contains only the flags which are
present in both self
and other
.
This is equivalent to using the &
operator (e.g.
ops::BitAnd
), as in flags & other
.
pub const fn union(self, other: ModifierKey) -> ModifierKey
pub const fn union(self, other: ModifierKey) -> ModifierKey
Returns the union of between the flags in self
and other
.
Specifically, the returned set contains all flags which are
present in either self
or other
, including any which are
present in both (see Self::symmetric_difference
if that
is undesirable).
This is equivalent to using the |
operator (e.g.
ops::BitOr
), as in flags | other
.
pub const fn difference(self, other: ModifierKey) -> ModifierKey
pub const fn difference(self, other: ModifierKey) -> ModifierKey
Returns the difference between the flags in self
and other
.
Specifically, the returned set contains all flags present in
self
, except for the ones present in other
.
It is also conceptually equivalent to the “bit-clear” operation:
flags & !other
(and this syntax is also supported).
This is equivalent to using the -
operator (e.g.
ops::Sub
), as in flags - other
.
pub const fn symmetric_difference(self, other: ModifierKey) -> ModifierKey
pub const fn symmetric_difference(self, other: ModifierKey) -> ModifierKey
Returns the symmetric difference between the flags
in self
and other
.
Specifically, the returned set contains the flags present which
are present in self
or other
, but that are not present in
both. Equivalently, it contains the flags present in exactly
one of the sets self
and other
.
This is equivalent to using the ^
operator (e.g.
ops::BitXor
), as in flags ^ other
.
pub const fn complement(self) -> ModifierKey
pub const fn complement(self) -> ModifierKey
Returns the complement of this set of flags.
Specifically, the returned set contains all the flags which are
not set in self
, but which are allowed for this type.
Alternatively, it can be thought of as the set difference
between Self::all()
and self
(e.g. Self::all() - self
)
This is equivalent to using the !
operator (e.g.
ops::Not
), as in !flags
.
impl ModifierKey
impl ModifierKey
pub fn event<E>(&mut self, e: &E)where
E: GenericEvent,
pub fn event<E>(&mut self, e: &E)where
E: GenericEvent,
Change modifier key state depending on input.
If the left or side button is released, it counts as a release.
Trait Implementations
impl Binary for ModifierKey
impl Binary for ModifierKey
impl BitAnd<ModifierKey> for ModifierKey
impl BitAnd<ModifierKey> for ModifierKey
fn bitand(self, other: ModifierKey) -> ModifierKey
fn bitand(self, other: ModifierKey) -> ModifierKey
Returns the intersection between the two sets of flags.
type Output = ModifierKey
type Output = ModifierKey
&
operator.impl BitAndAssign<ModifierKey> for ModifierKey
impl BitAndAssign<ModifierKey> for ModifierKey
fn bitand_assign(&mut self, other: ModifierKey)
fn bitand_assign(&mut self, other: ModifierKey)
Disables all flags disabled in the set.
impl BitOr<ModifierKey> for ModifierKey
impl BitOr<ModifierKey> for ModifierKey
fn bitor(self, other: ModifierKey) -> ModifierKey
fn bitor(self, other: ModifierKey) -> ModifierKey
Returns the union of the two sets of flags.
type Output = ModifierKey
type Output = ModifierKey
|
operator.impl BitOrAssign<ModifierKey> for ModifierKey
impl BitOrAssign<ModifierKey> for ModifierKey
fn bitor_assign(&mut self, other: ModifierKey)
fn bitor_assign(&mut self, other: ModifierKey)
Adds the set of flags.
impl BitXor<ModifierKey> for ModifierKey
impl BitXor<ModifierKey> for ModifierKey
fn bitxor(self, other: ModifierKey) -> ModifierKey
fn bitxor(self, other: ModifierKey) -> ModifierKey
Returns the left flags, but with all the right flags toggled.
type Output = ModifierKey
type Output = ModifierKey
^
operator.impl BitXorAssign<ModifierKey> for ModifierKey
impl BitXorAssign<ModifierKey> for ModifierKey
fn bitxor_assign(&mut self, other: ModifierKey)
fn bitxor_assign(&mut self, other: ModifierKey)
Toggles the set of flags.
impl Clone for ModifierKey
impl Clone for ModifierKey
fn clone(&self) -> ModifierKey
fn clone(&self) -> ModifierKey
1.0.0 · sourcefn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source
. Read moreimpl Debug for ModifierKey
impl Debug for ModifierKey
impl Default for ModifierKey
impl Default for ModifierKey
fn default() -> ModifierKey
fn default() -> ModifierKey
impl<'de> Deserialize<'de> for ModifierKey
impl<'de> Deserialize<'de> for ModifierKey
fn deserialize<__D>(
__deserializer: __D
) -> Result<ModifierKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(
__deserializer: __D
) -> Result<ModifierKey, <__D as Deserializer<'de>>::Error>where
__D: Deserializer<'de>,
impl Extend<ModifierKey> for ModifierKey
impl Extend<ModifierKey> for ModifierKey
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = ModifierKey>,
fn extend<T>(&mut self, iterator: T)where
T: IntoIterator<Item = ModifierKey>,
sourcefn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
extend_one
)sourcefn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
extend_one
)impl FromIterator<ModifierKey> for ModifierKey
impl FromIterator<ModifierKey> for ModifierKey
fn from_iter<T>(iterator: T) -> ModifierKeywhere
T: IntoIterator<Item = ModifierKey>,
fn from_iter<T>(iterator: T) -> ModifierKeywhere
T: IntoIterator<Item = ModifierKey>,
impl Hash for ModifierKey
impl Hash for ModifierKey
impl LowerHex for ModifierKey
impl LowerHex for ModifierKey
impl Not for ModifierKey
impl Not for ModifierKey
fn not(self) -> ModifierKey
fn not(self) -> ModifierKey
Returns the complement of this set of flags.
type Output = ModifierKey
type Output = ModifierKey
!
operator.impl Octal for ModifierKey
impl Octal for ModifierKey
impl Ord for ModifierKey
impl Ord for ModifierKey
fn cmp(&self, other: &ModifierKey) -> Ordering
fn cmp(&self, other: &ModifierKey) -> Ordering
1.21.0 · sourcefn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
1.21.0 · sourcefn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
1.50.0 · sourcefn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
fn clamp(self, min: Self, max: Self) -> Selfwhere
Self: Sized + PartialOrd<Self>,
impl PartialEq<ModifierKey> for ModifierKey
impl PartialEq<ModifierKey> for ModifierKey
fn eq(&self, other: &ModifierKey) -> bool
fn eq(&self, other: &ModifierKey) -> bool
impl PartialOrd<ModifierKey> for ModifierKey
impl PartialOrd<ModifierKey> for ModifierKey
fn partial_cmp(&self, other: &ModifierKey) -> Option<Ordering>
fn partial_cmp(&self, other: &ModifierKey) -> Option<Ordering>
1.0.0 · sourcefn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
self
and other
) and is used by the <=
operator. Read moreimpl Serialize for ModifierKey
impl Serialize for ModifierKey
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
fn serialize<__S>(
&self,
__serializer: __S
) -> Result<<__S as Serializer>::Ok, <__S as Serializer>::Error>where
__S: Serializer,
impl Sub<ModifierKey> for ModifierKey
impl Sub<ModifierKey> for ModifierKey
fn sub(self, other: ModifierKey) -> ModifierKey
fn sub(self, other: ModifierKey) -> ModifierKey
Returns the set difference of the two sets of flags.
type Output = ModifierKey
type Output = ModifierKey
-
operator.impl SubAssign<ModifierKey> for ModifierKey
impl SubAssign<ModifierKey> for ModifierKey
fn sub_assign(&mut self, other: ModifierKey)
fn sub_assign(&mut self, other: ModifierKey)
Disables all flags enabled in the set.
impl UpperHex for ModifierKey
impl UpperHex for ModifierKey
impl Copy for ModifierKey
impl Eq for ModifierKey
impl StructuralEq for ModifierKey
impl StructuralPartialEq for ModifierKey
Auto Trait Implementations
impl RefUnwindSafe for ModifierKey
impl Send for ModifierKey
impl Sync for ModifierKey
impl Unpin for ModifierKey
impl UnwindSafe for ModifierKey
Blanket Implementations
sourceimpl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
impl<T> Pointable for T
impl<T> Pointable for T
sourceimpl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
impl<R, P> ReadPrimitive<R> for Pwhere
R: Read + ReadEndian<P>,
P: Default,
sourcefn read_from_little_endian(read: &mut R) -> Result<Self, Error>
fn read_from_little_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_little_endian()
.sourcefn read_from_big_endian(read: &mut R) -> Result<Self, Error>
fn read_from_big_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_big_endian()
.sourcefn read_from_native_endian(read: &mut R) -> Result<Self, Error>
fn read_from_native_endian(read: &mut R) -> Result<Self, Error>
ReadEndian::read_from_native_endian()
.