pub trait KeyboardContext: FallibleContext {
    // Required methods
    fn key_down(
        &mut self,
        key: Key
    ) -> Result<(), GenericError<Self::PlatformError>>;
    fn key_up(
        &mut self,
        key: Key
    ) -> Result<(), GenericError<Self::PlatformError>>;

    // Provided method
    fn key_click(
        &mut self,
        key: Key
    ) -> Result<(), GenericError<Self::PlatformError>> { ... }
}
Expand description

A context that supports keyboard events.

Platform Differences

Key::Fn and Key::NumpadClear are supported on macOS only. In the future, they may be named to reflect this or removed entirely.

Required Methods§

source

fn key_down( &mut self, key: Key ) -> Result<(), GenericError<Self::PlatformError>>

Press down a key.

source

fn key_up(&mut self, key: Key) -> Result<(), GenericError<Self::PlatformError>>

Release a key.

Provided Methods§

source

fn key_click( &mut self, key: Key ) -> Result<(), GenericError<Self::PlatformError>>

Press and release a key.

This is equivalent to calling key_down followed by key_up. Although, some platforms may optimize this.

Implementors§