LowLevelInputHookType

Trait LowLevelInputHookType 

Source
pub trait LowLevelInputHookType: HookType + Copy {
    // Provided methods
    fn run_hook<F>(user_callback: F) -> Result<()>
       where F: FnMut(Self::Message) -> HookReturnValue { ... }
    fn add_hook<const ID: u32, F>(
        user_callback: F,
    ) -> Result<LowLevelInputHook<Self, F>>
       where F: FnMut(Self::Message) -> HookReturnValue { ... }
}
Available on crate feature hooking only.
Expand description

A global mouse or keyboard hook.

This hook can be used to listen to mouse (with LowLevelMouseHook) or keyboard (with LowLevelKeyboardHook) events, no matter which application or window they occur in.

Provided Methods§

Source

fn run_hook<F>(user_callback: F) -> Result<()>
where F: FnMut(Self::Message) -> HookReturnValue,

Source

fn add_hook<const ID: u32, F>( user_callback: F, ) -> Result<LowLevelInputHook<Self, F>>
where F: FnMut(Self::Message) -> HookReturnValue,

Adds a new hook with the given ID.

A ThreadMessageLoop must be run separately for user_callback to receive events.

§Panics

Will panic if a Hook with the given ID already exists for this thread.

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.

Implementors§