pub struct Keyboard<'a> { /* private fields */ }Expand description
A struct for controlling a virtual keyboard.
It holds a reference to a Device which is used to send the keyboard commands.
Implementations§
Source§impl<'a> Keyboard<'a>
impl<'a> Keyboard<'a>
Sourcepub fn press(&self, button: Key)
pub fn press(&self, button: Key)
Presses a single keyboard button.
The button is held down until a release() or multi_press() with Key::NONE is called.
§Arguments
button- TheKeyto press.
Sourcepub fn release(&self)
pub fn release(&self)
Releases all currently pressed keyboard buttons.
This effectively sends a “no keys pressed” command to the device.
Sourcepub fn press_and_release(&self, button: Key, millis: u64)
pub fn press_and_release(&self, button: Key, millis: u64)
Presses and releases a single keyboard button.
The button is pressed down, held for the specified duration, then released.
§Arguments
button- TheKeyto press and release.millis- The duration in milliseconds to hold the button down before releasing it.
Sourcepub fn multi_press(
&self,
button1: Key,
button2: Key,
button3: Key,
button4: Key,
button5: Key,
button6: Key,
)
pub fn multi_press( &self, button1: Key, button2: Key, button3: Key, button4: Key, button5: Key, button6: Key, )
Presses up to six keyboard buttons simultaneously.
This can be used for pressing modifier keys and other keys at the same time.
§Arguments
button1- The firstKeyto press.button2- The secondKeyto press.button3- The thirdKeyto press.button4- The fourthKeyto press.button5- The fifthKeyto press.button6- The sixthKeyto press.
Auto Trait Implementations§
impl<'a> Freeze for Keyboard<'a>
impl<'a> RefUnwindSafe for Keyboard<'a>
impl<'a> !Send for Keyboard<'a>
impl<'a> !Sync for Keyboard<'a>
impl<'a> Unpin for Keyboard<'a>
impl<'a> UnwindSafe for Keyboard<'a>
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