pub struct FieldCapture {
pub scratch: BytesMut,
/* private fields */
}Expand description
Visitor used by tracing’s Event::record(visitor) to extract typed
values into a thread-local scratch space; reused across emissions
(zero per-event allocation in the steady state). Spec 12 § 3.6.
The tracing::field::Visit impl lives in obs-tracing-bridge
(Phase 4B) so obs-core does not pull in the tracing crate. The
type lives here because the bridge’s register_typed::<E>(...)
closure receives &mut FieldCapture and a closure that returns
E: EventSchema belongs to the schema layer.
Fields§
§scratch: BytesMutReused encoder scratch for record_debug / record_display.
Implementations§
Source§impl FieldCapture
impl FieldCapture
Sourcepub fn clear(&mut self)
pub fn clear(&mut self)
Reset all sub-vectors but preserve their capacity. The bridge calls this between events to keep the steady state allocation- free. Spec 12 § 3.6.
Sourcepub fn record_str(&mut self, name: &'static str, value: impl Into<String>)
pub fn record_str(&mut self, name: &'static str, value: impl Into<String>)
Record a string field.
Sourcepub fn record_u64(&mut self, name: &'static str, value: u64)
pub fn record_u64(&mut self, name: &'static str, value: u64)
Record a u64 field.
Sourcepub fn record_i64(&mut self, name: &'static str, value: i64)
pub fn record_i64(&mut self, name: &'static str, value: i64)
Record an i64 field.
Sourcepub fn record_f64(&mut self, name: &'static str, value: f64)
pub fn record_f64(&mut self, name: &'static str, value: f64)
Record an f64 field.
Sourcepub fn record_bool(&mut self, name: &'static str, value: bool)
pub fn record_bool(&mut self, name: &'static str, value: bool)
Record a bool field.
Sourcepub fn string(&self, name: &str) -> Option<&str>
pub fn string(&self, name: &str) -> Option<&str>
Look up a string field by name; returns the last record (so
later writes shadow earlier ones, matching tracing’s own
Visit semantics).
Sourcepub fn duration(&self, name: &str) -> Option<Duration>
pub fn duration(&self, name: &str) -> Option<Duration>
Look up a u64 field that should be interpreted as nanoseconds.
Sourcepub fn iter_strings(&self) -> impl Iterator<Item = (&'static str, &str)> + '_
pub fn iter_strings(&self) -> impl Iterator<Item = (&'static str, &str)> + '_
Iterator of all recorded string fields. Used by promotion paths that walk every field looking for known label names.