pub struct Config<T = KeyboardEvent> {
pub on_released: Box<OnReleasedFn<T>>,
}Expand description
Configuration for the event handler’s behavior.
Used to define how to handle a modifier key after it has been pressed and released. For example, you can specify a callback to send a dummy key to prevent menu activation.
By default, it returns Some(VK__none_) to always suppress menu activation.
Fields§
§on_released: Box<OnReleasedFn<T>>A callback invoked when a key is released after being pressed.
Implementations§
Source§impl<T> Config<T>
impl<T> Config<T>
Sourcepub fn set_on_released<F: Fn(HoldEvent<T>) -> Option<VIRTUAL_KEY> + Send + Sync + 'static>(
self,
f: F,
) -> Self
pub fn set_on_released<F: Fn(HoldEvent<T>) -> Option<VIRTUAL_KEY> + Send + Sync + 'static>( self, f: F, ) -> Self
Sets the callback function to be invoked when a key is released.
This method updates the on_released field with the provided function,
which takes a HoldEvent representing the press and release of a modifier key.
The callback should return a dummy VIRTUAL_KEY to send, or None if no key should be sent.
§Arguments
f: A closure or function of typeFn(HoldEvent<T>) -> Option<VIRTUAL_KEY>.
§Returns
A modified Config instance with the new callback set (builder pattern).
Trait Implementations§
Auto Trait Implementations§
impl<T = KeyboardEvent> !RefUnwindSafe for Config<T>
impl<T = KeyboardEvent> !UnwindSafe for Config<T>
impl<T> Freeze for Config<T>
impl<T> Send for Config<T>
impl<T> Sync for Config<T>
impl<T> Unpin for Config<T>
impl<T> UnsafeUnpin for Config<T>
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more