Struct Event

struct Event<'a> { ... }

Events represent single points in time where something occurred during the execution of a program.

An Event can be compared to a log record in unstructured logging, but with two key differences:

Implementations

impl<'a> Event<'a>

fn dispatch(metadata: &'static Metadata<'static>, fields: &'a ValueSet<'_>)

Constructs a new Event with the specified metadata and set of values, and observes it with the current subscriber.

fn new(metadata: &'static Metadata<'static>, fields: &'a ValueSet<'a>) -> Self

Returns a new Event in the current span, with the specified metadata and set of values.

fn new_child_of<impl Into<Option<Id>>: Into<Option<Id>>>(parent: impl Into<Option<Id>>, metadata: &'static Metadata<'static>, fields: &'a ValueSet<'a>) -> Self

Returns a new Event as a child of the specified span, with the provided metadata and set of values.

fn child_of<impl Into<Option<Id>>: Into<Option<Id>>>(parent: impl Into<Option<Id>>, metadata: &'static Metadata<'static>, fields: &'a ValueSet<'_>)

Constructs a new Event with the specified metadata and set of values, and observes it with the current subscriber and an explicit parent.

fn record(self: &Self, visitor: &mut dyn Visit)

Visits all the fields on this Event with the specified visitor.

fn fields(self: &Self) -> Iter

Returns an iterator over the set of values on this Event.

fn metadata(self: &Self) -> &'static Metadata<'static>

Returns metadata describing this Event.

fn is_root(self: &Self) -> bool

Returns true if the new event should be a root.

fn is_contextual(self: &Self) -> bool

Returns true if the new event's parent should be determined based on the current context.

If this is true and the current thread is currently inside a span, then that span should be the new event's parent. Otherwise, if the current thread is not inside a span, then the new event will be the root of its own trace tree.

fn parent(self: &Self) -> Option<&Id>

Returns the new event's explicitly-specified parent, if there is one.

Otherwise (if the new event is a root or is a child of the current span), returns None.

impl<'a> Debug for Event<'a>

fn fmt(self: &Self, f: &mut Formatter<'_>) -> Result

impl<'a> Freeze for Event<'a>

impl<'a> RefUnwindSafe for Event<'a>

impl<'a> Send for Event<'a>

impl<'a> Sync for Event<'a>

impl<'a> Unpin for Event<'a>

impl<'a> UnsafeUnpin for Event<'a>

impl<'a> UnwindSafe for Event<'a>

impl<T> Any for Event<'a>

fn type_id(self: &Self) -> TypeId

impl<T> Borrow for Event<'a>

fn borrow(self: &Self) -> &T

impl<T> BorrowMut for Event<'a>

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

impl<T> From for Event<'a>

fn from(t: T) -> T

Returns the argument unchanged.

impl<T, U> Into for Event<'a>

fn into(self: Self) -> U

Calls U::from(self).

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

impl<T, U> TryFrom for Event<'a>

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

impl<T, U> TryInto for Event<'a>

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