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 new() -> FieldCapture
pub fn new() -> FieldCapture
Empty capture with default capacities.
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.
Trait Implementations§
Source§impl Debug for FieldCapture
impl Debug for FieldCapture
Source§impl Default for FieldCapture
impl Default for FieldCapture
Source§fn default() -> FieldCapture
fn default() -> FieldCapture
Auto Trait Implementations§
impl Freeze for FieldCapture
impl RefUnwindSafe for FieldCapture
impl Send for FieldCapture
impl Sync for FieldCapture
impl Unpin for FieldCapture
impl UnsafeUnpin for FieldCapture
impl UnwindSafe for FieldCapture
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> FutureExt for T
impl<T> FutureExt for T
Source§fn with_context(self, otel_cx: Context) -> WithContext<Self>
fn with_context(self, otel_cx: Context) -> WithContext<Self>
Source§fn with_current_context(self) -> WithContext<Self>
fn with_current_context(self) -> WithContext<Self>
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
Source§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
Source§impl<T> IntoRequest<T> for T
impl<T> IntoRequest<T> for T
Source§fn into_request(self) -> Request<T>
fn into_request(self) -> Request<T>
T in a tonic::Request