pub struct Event { /* private fields */ }Expand description
An event that represents a single point in time during the execution of a span.
Implementations§
Source§impl Event
impl Event
Sourcepub fn new(name: impl Into<Cow<'static, str>>) -> Self
pub fn new(name: impl Into<Cow<'static, str>>) -> Self
Create a new event with the given name.
§Examples
use fastrace::prelude::*;
LocalSpan::add_event(Event::new("event"));Sourcepub fn with_property<K, V, F>(self, property: F) -> Self
pub fn with_property<K, V, F>(self, property: F) -> Self
Add a single property to the Event and return the modified Event.
A property is an arbitrary key-value pair associated with an event.
§Examples
use fastrace::prelude::*;
LocalSpan::add_event(Event::new("event").with_property(|| ("key", "value")));Sourcepub fn with_properties<K, V, I, F>(self, properties: F) -> Self
pub fn with_properties<K, V, I, F>(self, properties: F) -> Self
Add multiple properties to the Event and return the modified Event.
§Examples
use fastrace::prelude::*;
LocalSpan::add_event(Event::new("event").with_properties(|| [("key1", "value")]));Sourcepub fn add_to_parent<I, F>(
name: impl Into<Cow<'static, str>>,
parent: &Span,
properties: F,
)
👎Deprecated since 0.7.8: use Span::add_event instead
pub fn add_to_parent<I, F>( name: impl Into<Cow<'static, str>>, parent: &Span, properties: F, )
Span::add_event insteadAdds an event to the parent span with the given name and properties.
§Examples
use fastrace::prelude::*;
let root = Span::root("root", SpanContext::random());
Event::add_to_parent("event in root", &root, || [("key".into(), "value".into())]);Sourcepub fn add_to_local_parent<I, F>(
name: impl Into<Cow<'static, str>>,
properties: F,
)
👎Deprecated since 0.7.8: use LocalSpan::add_event instead
pub fn add_to_local_parent<I, F>( name: impl Into<Cow<'static, str>>, properties: F, )
LocalSpan::add_event insteadAdds an event to the current local parent span with the given name and properties.
§Examples
use fastrace::prelude::*;
let root = Span::root("root", SpanContext::random());
let _guard = root.set_local_parent();
Event::add_to_local_parent("event in root", || [("key".into(), "value".into())]);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