pub trait EffectObserver:
Send
+ Sync
+ 'static {
// Provided methods
fn on_created(&self, record: &EffectRecord) { ... }
fn on_transition(&self, observation: &Observation<'_>) { ... }
}Expand description
Receives effect lifecycle events, for metrics. Both methods default to doing nothing.
Calls are synchronous and run on the runtime’s tasks: keep them cheap (increment a counter, record a histogram), and hand anything slow to another task.
Provided Methods§
Sourcefn on_created(&self, record: &EffectRecord)
fn on_created(&self, record: &EffectRecord)
A new effect was recorded (Pending).
Sourcefn on_transition(&self, observation: &Observation<'_>)
fn on_transition(&self, observation: &Observation<'_>)
A transition was stored.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".