#[repr(C, packed(1))]pub struct KeyboardInput { /* private fields */ }
Expand description
Keyboard input report
Implementations§
Source§impl KeyboardInput
impl KeyboardInput
Sourcepub fn pressed(&self) -> AllPressedKeys<'_>
pub fn pressed(&self) -> AllPressedKeys<'_>
Get iterator over pressed keys
Modifiers also returned as key codes before ordinary keys
Sourcepub fn count_pressed(&self) -> usize
pub fn count_pressed(&self) -> usize
Get number of all pressed keys
Sourcepub fn count_pressed_mods(&self) -> usize
pub fn count_pressed_mods(&self) -> usize
Get number of pressed modifiers
Sourcepub fn count_pressed_keys(&self) -> usize
pub fn count_pressed_keys(&self) -> usize
Get number of pressed keys excepting modifiers
Sourcepub fn pressed_keys(&self) -> &[Key]
pub fn pressed_keys(&self) -> &[Key]
Get slice of pressed keys excepting modifiers
Sourcepub fn is_pressed_key(&self, key: Key) -> bool
pub fn is_pressed_key(&self, key: Key) -> bool
Check is key pressed excepting modifiers
Sourcepub fn change_mods(&mut self, mask: Modifiers, state: bool)
pub fn change_mods(&mut self, mask: Modifiers, state: bool)
Press or release modifiers only
Sourcepub fn press_mods(&mut self, mask: Modifiers)
pub fn press_mods(&mut self, mask: Modifiers)
Press modifiers only
Sourcepub fn release_mods(&mut self, mask: Modifiers)
pub fn release_mods(&mut self, mask: Modifiers)
Release modifiers only
Sourcepub fn change_key(&mut self, key: Key, state: bool)
pub fn change_key(&mut self, key: Key, state: bool)
Press or release key
Sourcepub fn release_key(&mut self, key: Key)
pub fn release_key(&mut self, key: Key)
Release key
Sourcepub fn diff<'i>(&'i self, other: &'i KeyboardInput) -> KeyStateChanges<'i> ⓘ
pub fn diff<'i>(&'i self, other: &'i KeyboardInput) -> KeyStateChanges<'i> ⓘ
Get key state changes between two reports
Difference of two reports
Trait Implementations§
Source§impl AsMut<[u8]> for KeyboardInput
impl AsMut<[u8]> for KeyboardInput
Source§impl AsRef<[u8]> for KeyboardInput
impl AsRef<[u8]> for KeyboardInput
Source§impl Clone for KeyboardInput
impl Clone for KeyboardInput
Source§fn clone(&self) -> KeyboardInput
fn clone(&self) -> KeyboardInput
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 KeyboardInput
impl Debug for KeyboardInput
Source§impl Default for KeyboardInput
impl Default for KeyboardInput
Source§fn default() -> KeyboardInput
fn default() -> KeyboardInput
Returns the “default value” for a type. Read more
Source§impl Extend<KeyboardInput> for KeyboardInput
impl Extend<KeyboardInput> for KeyboardInput
Source§fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = KeyboardInput>,
fn extend<T>(&mut self, iter: T)where
T: IntoIterator<Item = KeyboardInput>,
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl Extend<StateChange<Key>> for KeyboardInput
impl Extend<StateChange<Key>> for KeyboardInput
Source§fn extend<T>(&mut self, iter: T)
fn extend<T>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl Extend<StateChange<Modifiers>> for KeyboardInput
impl Extend<StateChange<Modifiers>> for KeyboardInput
Source§fn extend<T>(&mut self, iter: T)
fn extend<T>(&mut self, iter: T)
Extends a collection with the contents of an iterator. Read more
Source§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one
)Extends a collection with exactly one element.
Source§fn extend_reserve(&mut self, additional: usize)
fn extend_reserve(&mut self, additional: usize)
🔬This is a nightly-only experimental API. (
extend_one
)Reserves capacity in a collection for the given number of additional elements. Read more
Source§impl<'i> Sub for &'i KeyboardInput
impl<'i> Sub for &'i KeyboardInput
Source§type Output = KeyStateChanges<'i>
type Output = KeyStateChanges<'i>
The resulting type after applying the
-
operator.Source§fn sub(self, other: &'i KeyboardInput) -> <&'i KeyboardInput as Sub>::Output
fn sub(self, other: &'i KeyboardInput) -> <&'i KeyboardInput as Sub>::Output
Performs the
-
operation. Read moreimpl Copy for KeyboardInput
Auto Trait Implementations§
impl Freeze for KeyboardInput
impl RefUnwindSafe for KeyboardInput
impl Send for KeyboardInput
impl Sync for KeyboardInput
impl Unpin for KeyboardInput
impl UnwindSafe for KeyboardInput
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