Skip to main content

TraceEvent

Trait TraceEvent 

Source
pub trait TraceEvent {
    // Required methods
    fn event_name() -> &'static str;
    fn field_defs() -> Vec<FieldDef>;
    fn timestamp(&self) -> u64;
    fn encode_fields<W: Write>(
        &self,
        enc: &mut EventEncoder<'_, W>,
    ) -> Result<()>;

    // Provided methods
    fn type_slot() -> u16 { ... }
    fn schema_entry() -> SchemaEntry { ... }
}
Expand description

Trait implemented by #[derive(TraceEvent)] for compile-time event types.

Required Methods§

Source

fn event_name() -> &'static str

The event type name (used in schema registration).

Source

fn field_defs() -> Vec<FieldDef>

Field definitions for schema registration. The timestamp is NOT included here — it is encoded in the event frame header.

Source

fn timestamp(&self) -> u64

Return the event’s timestamp in nanoseconds.

Source

fn encode_fields<W: Write>(&self, enc: &mut EventEncoder<'_, W>) -> Result<()>

Encode this event’s non-timestamp fields into the encoder.

Provided Methods§

Source

fn type_slot() -> u16

Per-type wire-ID slot. Default 0 means no slot (dynamic path); #[traceevent(wire_slot)] overrides it to claim a fast-path slot.

Source

fn schema_entry() -> SchemaEntry

Build a SchemaEntry for this event type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety".

Implementors§