pub struct Event {
pub name: &'static str,
pub action: Action,
pub category: Option<EventCategory>,
pub outcome: EventOutcome,
pub duration_ms: Option<u64>,
pub attrs: Option<Value>,
}Expand description
One emission’s call-site descriptor. Built by the record! macro
from the Event constructor + builder calls and consumed by the layer.
Everything is by-value; the macro takes &Event to keep call sites
non-moving.
Fields§
§name: &'static str§action: Action§category: Option<EventCategory>§outcome: EventOutcome§duration_ms: Option<u64>§attrs: Option<Value>Implementations§
Source§impl Event
impl Event
pub fn new(name: &'static str, action: Action) -> Self
pub fn with_category(self, category: EventCategory) -> Self
pub fn with_outcome(self, outcome: EventOutcome) -> Self
pub fn with_duration(self, duration_ms: u64) -> Self
pub fn with_attrs(self, attrs: Value) -> Self
pub fn category_str(&self) -> &'static str
pub fn outcome_str(&self) -> &'static str
Sourcepub fn attrs_str(&self) -> String
pub fn attrs_str(&self) -> String
JSON-encode the attrs payload as a string for tracing::event!
transport. Layer parses back to Value.
pub fn duration_ms_or_zero(&self) -> u64
pub fn has_duration(&self) -> bool
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Event
impl RefUnwindSafe for Event
impl Send for Event
impl Sync for Event
impl Unpin for Event
impl UnsafeUnpin for Event
impl UnwindSafe for Event
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
Mutably borrows from an owned value. Read more