Skip to main content

Hook

Trait Hook 

Source
pub trait Hook:
    'static
    + Send
    + Sync {
    // Required methods
    fn should_intercept(&self, kind: EventKind) -> bool;
    fn intercept_event(&self, event: Event);
}

Required Methods§

Source

fn should_intercept(&self, kind: EventKind) -> bool

Return true if you want to intercept the given event kind. Self::intercept_event won’t be called kinds this method returned false

Source

fn intercept_event(&self, event: Event)

Hooks must not block the event stream; this method should be a cheap synchronous call. Delegate heavy work to another thread or spawn async tasks internally.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§