[−][src]Trait winput::Keylike
A trait for objects that can be used as keys. For example a Vk
or a char
can be
used as a key.
Example
ⓘ
use winput::{Vk, Keylike}; Vk::Control.press().unwrap(); Vk::A.trigger().unwrap(); Vk::Control.release().unwrap();
Required methods
pub fn produce_input(self, action: Action) -> Input
[src]
Produces an Input
that causes the given action to be taken on self
.
Panics
This function panics if self
was not a valid key. For example, any char
that
is above 0x0000ffff
cannot be turned into an Input
.
Example
ⓘ
use winput::{Keylike, Action}; let input = 'A'.produce_input(Action::Press); winput::send_inputs(&[input]);
Provided methods
pub fn press(self) -> Result<(), WindowsError>
[src]
Synthesize an event that presses the key.
Panics
This function panics if self
was not a valid key. For example, any char
that
is above 0x0000ffff
cannot be turned into an Input
.
Example
ⓘ
use winput::Keylike; 'A'.press().unwrap();
pub fn release(self) -> Result<(), WindowsError>
[src]
Synthesizes an event that releases the key.
Panics
This function panics if self
was not a valid key. For example, any char
that
is above 0x0000ffff
cannot be turned into an Input
.
Example
ⓘ
use winput::Keylike; 'B'.release().unwrap();