Skip to main content

Subscriber

Trait Subscriber 

Source
pub trait Subscriber: Send + Sync {
    // Required method
    fn on_event(&self, event: &Event);

    // Provided methods
    fn on_profile(&self, _record: &ProfileRecord) { ... }
    fn on_slow_statement(&self, _signal: &SlowStatement) { ... }
    fn on_stress_failure(&self, _context: &StressFailureContext) { ... }
}
Expand description

Host-routed subscriber boundary.

dev/design/lifecycle.md § Host-routed diagnostics requires that all engine and SQLite-internal diagnostics flow through the host’s chosen subscriber. No private sink, no stderr fallback.

on_profile and on_slow_statement are default-no-op so existing subscribers compile unchanged. Their payload shapes are owned by dev/design/lifecycle.md § Per-statement profiling and § Slow and heartbeat policy. A statement that crosses the slow threshold emits both a SlowStatement signal here AND a Phase::Slow lifecycle event via on_event, per the design’s two-correlated-facts contract.

Required Methods§

Source

fn on_event(&self, event: &Event)

Provided Methods§

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§