pub trait GenericKey: GenericKeyInternal {
// Provided methods
fn is_pressed(self) -> Result<bool> { ... }
fn press(self) -> Result<()> { ... }
fn release(self) -> Result<()> { ... }
fn send_combination(keys: &[Self]) -> Result<()> { ... }
}
Available on crate feature
input
only.Expand description
A KeyboardKey
or a MouseButton
.
Provided Methods§
fn is_pressed(self) -> Result<bool>
Sourcefn press(self) -> Result<()>
fn press(self) -> Result<()>
Globally sends a ‘press’ event (without a corresponding ‘release’).
This can conflict with existing user key presses. Use Self::is_pressed
to avoid this.
Sourcefn send_combination(keys: &[Self]) -> Result<()>
fn send_combination(keys: &[Self]) -> Result<()>
Globally sends a key (or mouse button) combination as if the user had performed it.
This will cause a ‘press’ event for each key in the list (in the given order), followed by a sequence of ‘release’ events (in the inverse order).
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.