pub struct UseKeyboard {
pub pressed: Signal<String>,
/* private fields */
}Expand description
Reactive state for the keyboard.
The handle carries the key that is currently held down and the teardown that removes the window listeners.
The key is a Signal<String>: a render closure that reads it
re-renders when a key goes down or comes up, and nothing else in
the tree is disturbed.
Fields§
§pressed: Signal<String>The key currently held down, empty when no key is down.
Implementations§
Source§impl UseKeyboard
Inherent implementation of UseKeyboard.
impl UseKeyboard
Inherent implementation of UseKeyboard.
Sourcepub fn current_key(&self) -> String
pub fn current_key(&self) -> String
Returns the key currently held down as a snapshot.
§Returns
String- The key, or an empty string when no key is down.
Source§impl UseKeyboard
impl UseKeyboard
pub fn get_pressed(&self) -> Signal<String>
pub fn get_mut_pressed(&mut self) -> &mut Signal<String>
pub fn set_pressed(&mut self, val: Signal<String>) -> &mut Self
pub fn get_mut_teardown(&mut self) -> &mut Rc<RefCell<Option<Box<dyn Fn()>>>>
pub fn set_teardown( &mut self, val: Rc<RefCell<Option<Box<dyn Fn()>>>>, ) -> &mut Self
Trait Implementations§
Source§impl Clone for UseKeyboard
impl Clone for UseKeyboard
Source§impl Debug for UseKeyboard
impl Debug for UseKeyboard
Auto Trait Implementations§
impl !RefUnwindSafe for UseKeyboard
impl !Send for UseKeyboard
impl !Sync for UseKeyboard
impl !UnwindSafe for UseKeyboard
impl Freeze for UseKeyboard
impl Unpin for UseKeyboard
impl UnsafeUnpin for UseKeyboard
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