Skip to main content

EventKind

Trait EventKind 

Source
pub trait EventKind:
    Sealed
    + Sized
    + 'static {
    const EVENT_TYPE: EventType;

    // Required methods
    fn into_event(self) -> Event;
    fn try_from_event(event: Event) -> Result<Self, Event>;
    fn try_from_event_ref(event: &Event) -> Option<&Self>;
    fn try_from_event_mut(event: &mut Event) -> Option<&mut Self>;
}
Expand description

A type of telemetry event, such as Metric or Trace.

This lets code work with one event type generically: for example, event buffers provide typed views over just the events of a given type. It’s implemented for each type an Event can hold, and can’t be implemented elsewhere.

Required Associated Constants§

Source

const EVENT_TYPE: EventType

The event type.

Required Methods§

Source

fn into_event(self) -> Event

Wraps this value in an Event.

Source

fn try_from_event(event: Event) -> Result<Self, Event>

Unwraps the given event if it’s of this type, or returns it unchanged if it isn’t.

Source

fn try_from_event_ref(event: &Event) -> Option<&Self>

Returns a reference to the inner value of the given event, if it’s of this type.

Source

fn try_from_event_mut(event: &mut Event) -> Option<&mut Self>

Returns a mutable reference to the inner value of the given event, if it’s of this type.

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§

Source§

impl EventKind for EventD

Source§

const EVENT_TYPE: EventType = EventType::EventD

Source§

impl EventKind for Log

Source§

const EVENT_TYPE: EventType = EventType::Log

Source§

impl EventKind for Metric

Source§

const EVENT_TYPE: EventType = EventType::Metric

Source§

impl EventKind for Opaque

Source§

const EVENT_TYPE: EventType = EventType::Opaque

Source§

impl EventKind for ServiceCheck

Source§

const EVENT_TYPE: EventType = EventType::ServiceCheck

Source§

impl EventKind for Trace

Source§

const EVENT_TYPE: EventType = EventType::Trace

Source§

impl EventKind for TraceStats

Source§

const EVENT_TYPE: EventType = EventType::TraceStats