pub trait ContextRecord<S1, S2> {
// Required method
fn record_field(&mut self, key: S1, val: S2);
// Provided method
fn record(&mut self, key: S1, val: S2)
where Self: Sized { ... }
}Expand description
Record human-readable key-value context into the context stack.
Values recorded via this trait appear in the error’s Display output under
the “Context stack” section — they are intended for terminal/console visibility.
For typed metadata that should not appear in Display output (e.g.
structured fields for serialization, snapshots, or API responses), use
ErrorMetadata via OperationContext::with_meta() instead.