pub struct Event {
pub level: Level,
pub code: &'static str,
pub value: Option<f32>,
}Expand description
A structured telemetry event.
An event pairs a Level with a stable, short code - a label such as
"battery.low" or "link.lost" rather than a free-form message - so events stay
tiny, group cleanly into counts, and need no allocation. An optional value
carries an associated measurement, such as the battery level that triggered it.
Fields§
§level: LevelThe event’s severity.
code: &'static strA stable, short identifier for what happened.
value: Option<f32>An optional measurement associated with the event.
Implementations§
Source§impl Event
impl Event
Sourcepub fn trace(code: &'static str) -> Self
pub fn trace(code: &'static str) -> Self
Creates a Level::Trace event.
§Arguments
code- a stable, short identifier for the event.
§Returns
The event.
Sourcepub fn debug(code: &'static str) -> Self
pub fn debug(code: &'static str) -> Self
Creates a Level::Debug event.
§Arguments
code- a stable, short identifier for the event.
§Returns
The event.
Sourcepub fn info(code: &'static str) -> Self
pub fn info(code: &'static str) -> Self
Creates a Level::Info event.
§Arguments
code- a stable, short identifier for the event.
§Returns
The event.
Sourcepub fn warn(code: &'static str) -> Self
pub fn warn(code: &'static str) -> Self
Creates a Level::Warn event.
§Arguments
code- a stable, short identifier for the event.
§Returns
The event.
Sourcepub fn error(code: &'static str) -> Self
pub fn error(code: &'static str) -> Self
Creates a Level::Error event.
§Arguments
code- a stable, short identifier for the event.
§Returns
The event.
Sourcepub fn with_value(self, value: f32) -> Self
pub fn with_value(self, value: f32) -> Self
Trait Implementations§
impl Copy for Event
impl StructuralPartialEq for Event
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