Skip to main content

HeadlessAppKeyboardExt

Trait HeadlessAppKeyboardExt 

Source
pub trait HeadlessAppKeyboardExt {
    // Required methods
    fn on_keyboard_input(
        &mut self,
        window_id: WindowId,
        code: KeyCode,
        location: KeyLocation,
        key: Key,
        state: KeyState,
    );
    fn press_key(
        &mut self,
        window_id: WindowId,
        code: KeyCode,
        location: KeyLocation,
        key: Key,
    );
    fn press_modified_key(
        &mut self,
        window_id: WindowId,
        modifiers: ModifiersState,
        code: KeyCode,
        location: KeyLocation,
        key: Key,
    );
}
Expand description

Extension trait that adds keyboard simulation methods to HeadlessApp.

Required Methods§

Source

fn on_keyboard_input( &mut self, window_id: WindowId, code: KeyCode, location: KeyLocation, key: Key, state: KeyState, )

Notifies keyboard input event.

Note that the app is not updated so the event is pending after this call.

Source

fn press_key( &mut self, window_id: WindowId, code: KeyCode, location: KeyLocation, key: Key, )

Does a key-down, key-up and updates.

Source

fn press_modified_key( &mut self, window_id: WindowId, modifiers: ModifiersState, code: KeyCode, location: KeyLocation, key: Key, )

Does a modifiers changed, key-down, key-up, reset modifiers and updates.

Dyn Compatibility§

This trait is dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementations on Foreign Types§

Source§

impl HeadlessAppKeyboardExt for HeadlessApp

Source§

fn on_keyboard_input( &mut self, window_id: WindowId, code: KeyCode, location: KeyLocation, key: Key, state: KeyState, )

Source§

fn press_key( &mut self, window_id: WindowId, code: KeyCode, location: KeyLocation, key: Key, )

Source§

fn press_modified_key( &mut self, window_id: WindowId, modifiers: ModifiersState, code: KeyCode, location: KeyLocation, key: Key, )

Implementors§