pub struct WinEventHook<F> { /* private fields */ }Available on crate feature
hooking only.Expand description
A hook for various UI events.
The hook will be removed when this struct is dropped.
Implementations§
Source§impl<F> WinEventHook<F>where
F: FnMut(WinEventMessage),
impl<F> WinEventHook<F>where
F: FnMut(WinEventMessage),
Sourcepub fn new<const ID: u32>(
user_callback: F,
filter_events: Option<&[WinEventKind]>,
) -> Result<Self>
pub fn new<const ID: u32>( user_callback: F, filter_events: Option<&[WinEventKind]>, ) -> Result<Self>
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.
Sourcepub fn run_hook_loop(
user_callback: F,
filter_events: Option<&[WinEventKind]>,
) -> Result<()>
pub fn run_hook_loop( user_callback: F, filter_events: Option<&[WinEventKind]>, ) -> Result<()>
Runs a new hook with ID 0 on a new thread message loop (ThreadMessageLoop).
This will block the current thread to process messages.
§Panics
Will panic if a Hook with ID 0 already exists for this thread
or if the thread message loop lock is already acquired.
Auto Trait Implementations§
impl<F> Freeze for WinEventHook<F>
impl<F> RefUnwindSafe for WinEventHook<F>where
F: RefUnwindSafe,
impl<F> !Send for WinEventHook<F>
impl<F> !Sync for WinEventHook<F>
impl<F> Unpin for WinEventHook<F>
impl<F> UnwindSafe for WinEventHook<F>where
F: RefUnwindSafe,
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