pub struct KeyState { /* private fields */ }Expand description
Tracks which keys are currently held down.
Feed it every KeyEvent (or Event) you receive and query
is_held each frame for held-key movement. A key is
considered held from its first KeyEventKind::Press until a matching
KeyEventKind::Release.
This is only useful on backends that emit release events (winit, or a
terminal with the kitty keyboard protocol). On press-only backends a key
never leaves the held set on its own, so call clear at a
suitable boundary (e.g. once per turn) if you rely on it there.
Implementations§
Trait Implementations§
Auto Trait Implementations§
impl Freeze for KeyState
impl RefUnwindSafe for KeyState
impl Send for KeyState
impl Sync for KeyState
impl Unpin for KeyState
impl UnsafeUnpin for KeyState
impl UnwindSafe for KeyState
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