pub trait Key:
Copy
+ Eq
+ 'static {
const MAX_KEYS: usize;
const KEYS: &'static [Self];
const KEY_STRS: &'static [&'static str];
const DURATION_PATH: &'static [Self];
const TIMESTAMP_PATH: &'static [Self];
const ID_PATH: &'static [Self];
// Required methods
fn as_str(self) -> &'static str;
fn as_index(self) -> usize;
}Expand description
Trait for wide-event keys.
Each variant of a key enum represents a JSON key in the wide event.
The wide_log! macro generates the enum and this trait impl
automatically from the JSON structure — users do not implement this
trait manually.
§Path-Based Duration / Timestamp / ID
DURATION_PATH specifies the nested path to the
duration field (e.g. [Duration, TotalMs]). The guard auto-sets this
field to the elapsed time in milliseconds on drop.
TIMESTAMP_PATH specifies the nested path to the
timestamp field (e.g. [Event, Timestamp]). The guard auto-sets this
field to the current time as an RFC 3339 string on drop.
ID_PATH specifies the nested path to the id field
(e.g. [Event, Id]). The builder auto-sets this field to the generated
ID string on build().
The user does not define Log, Level, or Message variants. Log
entries are handled entirely internally by a LogEntry type and the
log_entries field on WideEvent.
Required Associated Constants§
Sourceconst KEY_STRS: &'static [&'static str]
const KEY_STRS: &'static [&'static str]
All key strings in enum order, indexed by as_index.
Used for O(1) as_str() via array index instead of a match.
Sourceconst DURATION_PATH: &'static [Self]
const DURATION_PATH: &'static [Self]
Path to the duration field (e.g. [Duration, TotalMs]).
Auto-set by the guard on drop. The value is in milliseconds (u64).
Sourceconst TIMESTAMP_PATH: &'static [Self]
const TIMESTAMP_PATH: &'static [Self]
Path to the timestamp field (e.g. [Event, Timestamp]).
Auto-set by the guard on drop. The value is an RFC 3339 string.
Required Methods§
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety".