Skip to main content

EventPredicate

Type Alias EventPredicate 

Source
pub type EventPredicate = Arc<dyn Fn(&Event) -> bool + Send + Sync>;
Expand description

A caller-supplied escape-hatch predicate (the predicate field of EventFilter). Returns true to keep the event.

Contract (locking discipline, audit M1). The predicate is evaluated under the bus mutex during the publish snapshot phase, before the lock is dropped for delivery. It must be cheap and MUST NOT re-enter the bus (no subscribe / publish / subscription_count from inside it) – doing so would deadlock on the inner mutex. Modes prefer the declarative path_glob / major_modes fields (mode-architecture.md §7.4); predicate is for the rare case those can’t express (init.rs custom rules).

Aliased Type§

pub struct EventPredicate { /* private fields */ }