Skip to main content

GenericKey

Trait GenericKey 

Source
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

Provided Methods§

Source

fn is_pressed(self) -> Result<bool>

Source

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.

Source

fn release(self) -> Result<()>

Globally sends a ‘release’ event.

Source

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".

Implementors§