Skip to main content

Event

Struct Event 

Source
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

Source

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"));
Source

pub fn with_property<K, V, F>(self, property: F) -> Self
where K: Into<Cow<'static, str>>, V: Into<Cow<'static, str>>, F: FnOnce() -> (K, V),

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")));
Source

pub fn with_properties<K, V, I, F>(self, properties: F) -> Self
where K: Into<Cow<'static, str>>, V: Into<Cow<'static, str>>, I: IntoIterator<Item = (K, V)>, F: FnOnce() -> I,

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")]));
Source

pub fn add_to_parent<I, F>( name: impl Into<Cow<'static, str>>, parent: &Span, properties: F, )
where I: IntoIterator<Item = (Cow<'static, str>, Cow<'static, str>)>, F: FnOnce() -> I,

👎Deprecated since 0.7.8: use Span::add_event instead

Adds 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())]);
Source

pub fn add_to_local_parent<I, F>( name: impl Into<Cow<'static, str>>, properties: F, )
where I: IntoIterator<Item = (Cow<'static, str>, Cow<'static, str>)>, F: FnOnce() -> I,

👎Deprecated since 0.7.8: use LocalSpan::add_event instead

Adds 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> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
Source§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

Source§

fn vzip(self) -> V