pub trait Trace: Sized {
type Label: Clone;
type TimeStamp: TimeStamp;
// Required methods
fn emit(&self, ev: TraceEvent<Self::Label, Self::TimeStamp>);
fn report(self) -> Vec<TraceEvent<Self::Label, Self::TimeStamp>>;
// Provided methods
fn emit_span(&self, label: Self::Label) -> SpanHandle<'_, Self> { ... }
fn emit_on_the_fly(&self, label: Self::Label) { ... }
}
Expand description
This trait describes a trace that is behind some sort of interior mutability mechanism. It can
log trace events and later make these available. This is usually an argument to the
trace_span
function attribute macro in `libcrux-macros``, but it can also be called manually.
When used with the trace_span
macros, this needs to be a global static. For defining and
instantiating this, take a look at std::sync::LazyLock
.
Required Associated Types§
Required Methods§
Sourcefn emit(&self, ev: TraceEvent<Self::Label, Self::TimeStamp>)
fn emit(&self, ev: TraceEvent<Self::Label, Self::TimeStamp>)
Writes an event to the trace.
Provided Methods§
Sourcefn emit_span(&self, label: Self::Label) -> SpanHandle<'_, Self>
fn emit_span(&self, label: Self::Label) -> SpanHandle<'_, Self>
Emits an event of type EventType::SpanOpen and returns a SpanHandle
that emits another
EventType::SpanClose
when dropped.
Sourcefn emit_on_the_fly(&self, label: Self::Label)
fn emit_on_the_fly(&self, label: Self::Label)
Emits an EventType::OnTheFly
event.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.