pub struct ThreadLocalEncoder<'a> { /* private fields */ }Expand description
Scoped encoder for writing events into the thread-local trace buffer.
Provides access to string interning and event encoding. The borrow lifetime
ensures that InternedString handles created via intern_string
are used within the same batch — they become invalid after the buffer flushes.
You don’t construct this directly; it’s passed to Encodable::encode.
Implementations§
Source§impl ThreadLocalEncoder<'_>
impl ThreadLocalEncoder<'_>
Sourcepub fn intern_string(&mut self, s: &str) -> InternedString
pub fn intern_string(&mut self, s: &str) -> InternedString
Intern a string into the trace’s string pool, returning a compact handle.
If the string was already interned in this batch, returns the existing handle
(no duplicate wire data). The returned InternedString is only valid for
encoding within this same Encodable::encode call.
Sourcepub fn intern_stack_frames(&mut self, frames: &[u64]) -> InternedStackFrames
pub fn intern_stack_frames(&mut self, frames: &[u64]) -> InternedStackFrames
Intern a stack-frame vector into the trace’s stack pool, returning a compact handle.
If the stack was already interned in this batch, returns the existing handle
(no duplicate wire data). The returned InternedStackFrames is only valid for
encoding within this same Encodable::encode call.
Sourcepub fn encode(&mut self, event: &impl TraceEvent)
pub fn encode(&mut self, event: &impl TraceEvent)
Encode a TraceEvent struct into the buffer.
Trait Implementations§
Auto Trait Implementations§
impl<'a> !UnwindSafe for ThreadLocalEncoder<'a>
impl<'a> Freeze for ThreadLocalEncoder<'a>
impl<'a> RefUnwindSafe for ThreadLocalEncoder<'a>
impl<'a> Send for ThreadLocalEncoder<'a>
impl<'a> Sync for ThreadLocalEncoder<'a>
impl<'a> Unpin for ThreadLocalEncoder<'a>
impl<'a> UnsafeUnpin for ThreadLocalEncoder<'a>
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
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> ⓘ
impl<T> Read<Exclusive, BecauseExclusive> for Twhere
T: ?Sized,
Source§impl<V, F> ValueFormatter<&V> for F
impl<V, F> ValueFormatter<&V> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &&V)
fn format_value(writer: impl ValueWriter, value: &&V)
value to writerSource§impl<V, F> ValueFormatter<Arc<V>> for F
impl<V, F> ValueFormatter<Arc<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Arc<V>)
fn format_value(writer: impl ValueWriter, value: &Arc<V>)
value to writerSource§impl<V, F> ValueFormatter<Box<V>> for F
impl<V, F> ValueFormatter<Box<V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Box<V>)
fn format_value(writer: impl ValueWriter, value: &Box<V>)
value to writerSource§impl<V, F> ValueFormatter<Cow<'_, V>> for F
impl<V, F> ValueFormatter<Cow<'_, V>> for F
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
fn format_value(writer: impl ValueWriter, value: &Cow<'_, V>)
value to writerSource§impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
impl<V, F> ValueFormatter<Option<V>> for Fwhere
F: ValueFormatter<V> + ?Sized,
Source§const SHAPE: FieldShape<'static>
const SHAPE: FieldShape<'static>
metrique_require_explicit_impls only.Source§fn format_value(writer: impl ValueWriter, value: &Option<V>)
fn format_value(writer: impl ValueWriter, value: &Option<V>)
value to writer