pub trait TraceEvent {
type Ref<'a>;
// 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<()>;
fn decode<'a>(
timestamp_ns: Option<u64>,
fields: &[FieldValueRef<'a>],
) -> Option<Self::Ref<'a>>;
// Provided methods
fn has_timestamp() -> bool { ... }
fn schema_entry() -> SchemaEntry { ... }
}Expand description
Trait implemented by #[derive(TraceEvent)] for compile-time event types.
Required Associated Types§
Required Methods§
Sourcefn event_name() -> &'static str
fn event_name() -> &'static str
The event type name (used in schema registration).
Sourcefn field_defs() -> Vec<FieldDef>
fn field_defs() -> Vec<FieldDef>
Field definitions for schema registration.
When has_timestamp() is true, the timestamp is NOT included here —
it is encoded in the event frame header.
Sourcefn encode_fields<W: Write>(&self, enc: &mut EventEncoder<'_, W>) -> Result<()>
fn encode_fields<W: Write>(&self, enc: &mut EventEncoder<'_, W>) -> Result<()>
Encode this event’s non-timestamp fields into the encoder.
Provided Methods§
Sourcefn has_timestamp() -> bool
fn has_timestamp() -> bool
Whether this event type carries a packed timestamp in the event header.
Sourcefn schema_entry() -> SchemaEntry
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", so this trait is not object safe.