pub trait ModifierTraceSink: Send + Sync {
// Required method
fn modifier_applied(
&self,
op: &str,
field: &'static str,
value_fn: &dyn Fn() -> Value,
);
}Expand description
Cross-cutting observer for modifier application.
One sink per session, installed via
install_session_sink. The chain hands the sink the op
label, the field name, and a closure that produces the
diagnostic JSON on demand. Sinks SHOULD check their own
filter state before invoking the closure — diagnostic_value
can do real work (string formatting, struct serialization)
and we want that paid only when a consumer will read it.
Built-in implementations:
TraceRouterSink— routes to [crate::trace_router] with a{component: "op_modifier", op: <label>, field: <name>}label set. Gates on [crate::trace_router::enabled] so the closure is invoked only when at least one trace target is configured.
Future:
JsonEventSink— writes structured records to the SRD-44a checkpoint JSONL. To be added when the JSON event-log subscription path lands.
Required Methods§
Sourcefn modifier_applied(
&self,
op: &str,
field: &'static str,
value_fn: &dyn Fn() -> Value,
)
fn modifier_applied( &self, op: &str, field: &'static str, value_fn: &dyn Fn() -> Value, )
Invoked from ModifierChain::apply after a modifier
runs. value_fn produces the JSON diagnostic on demand;
the sink decides whether to invoke it.
Dyn Compatibility§
This trait is dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".