pub struct Keyboard<Key, Mods>{ /* private fields */ }
Expand description
A structure representing the current state of a keyboard.
Implementations§
Trait Implementations§
Source§impl<T> Event<Keyboard<KeyCode, Modifiers>> for Event<T>
impl<T> Event<Keyboard<KeyCode, Modifiers>> for Event<T>
Source§fn handle(&self, keyboard: &mut WinitKeyboard)
fn handle(&self, keyboard: &mut WinitKeyboard)
Source§impl<K, M> KeyboardInterface for Keyboard<K, M>
impl<K, M> KeyboardInterface for Keyboard<K, M>
Source§fn pressed(&self, key: Self::Key) -> bool
fn pressed(&self, key: Self::Key) -> bool
Returns
true
if the given key was pressed this frame.Source§fn released(&self, key: Self::Key) -> bool
fn released(&self, key: Self::Key) -> bool
Returns
true
if the given key was released this frame.Source§fn clear_presses(&mut self) -> &mut Self
fn clear_presses(&mut self) -> &mut Self
Clears the pressed state of held buttons. Should be called at end of frame.
Source§fn set_modifiers(&mut self, modifiers: Self::Mods) -> &mut Self
fn set_modifiers(&mut self, modifiers: Self::Mods) -> &mut Self
Register that the current state of the modifier keys has changed.
Source§fn receive_text<S: AsRef<str>>(&mut self, text: S) -> &mut Self
fn receive_text<S: AsRef<str>>(&mut self, text: S) -> &mut Self
Register that some text was input.
Source§fn receive_char(&mut self, ch: char) -> &mut Self
fn receive_char(&mut self, ch: char) -> &mut Self
Register that a character of text was input.
Source§fn handle_event<E: Event<Self>>(&mut self, event: &E) -> &mut Self
fn handle_event<E: Event<Self>>(&mut self, event: &E) -> &mut Self
Convenience method for handling events. The type of event,
E
, will
vary depending on the windowing library being used.Auto Trait Implementations§
impl<Key, Mods> Freeze for Keyboard<Key, Mods>
impl<Key, Mods> RefUnwindSafe for Keyboard<Key, Mods>where
Mods: RefUnwindSafe,
Key: RefUnwindSafe,
impl<Key, Mods> Send for Keyboard<Key, Mods>
impl<Key, Mods> Sync for Keyboard<Key, Mods>
impl<Key, Mods> Unpin for Keyboard<Key, Mods>
impl<Key, Mods> UnwindSafe for Keyboard<Key, Mods>
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
Source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Convert
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.Source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Convert
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.Source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
Convert
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.Source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
Convert
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.