Skip to main content

Observer

Trait Observer 

Source
pub trait Observer:
    Send
    + Sync
    + 'static {
    // Required method
    fn observe(&self, event: &Event);

    // Provided method
    fn observes_shadow_outcomes(&self) -> bool { ... }
}
Expand description

Receives every public diagnostic. Failures (returned errors or panics) never change a cache, source or maintenance result.

Required Methods§

Source

fn observe(&self, event: &Event)

Receive one event. Called inline on the cache’s own path under panic isolation, so it should return quickly and never block.

Provided Methods§

Source

fn observes_shadow_outcomes(&self) -> bool

Whether this observer consumes shadow validation outcomes.

Shadow validation is diagnostic work that exists only to be observed, so the cache admits a shadow job only when the observer opts in by returning true. The bundled metric exporters opt in.

Dyn Compatibility§

This trait is dyn compatible.

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

Implementors§