EnteredTraceSpan

Trait EnteredTraceSpan 

Source
pub trait EnteredTraceSpan {
    // Required method
    fn or_if_tracing_disabled(self, f: impl FnOnce()) -> Self;
}
Expand description

A marker trait returned by crate::interpret::Machine::enter_trace_span, identifying either a real tracing::span::EnteredSpan in case tracing is enabled, or the dummy type () when tracing is disabled. Also see crate::enter_trace_span! below.

Required Methods§

Source

fn or_if_tracing_disabled(self, f: impl FnOnce()) -> Self

Allows executing an alternative function when tracing is disabled. Useful for example if you want to open a trace span when tracing is enabled, and alternatively just log a line when tracing is disabled.

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.

Implementations on Foreign Types§

Source§

impl EnteredTraceSpan for ()

Source§

fn or_if_tracing_disabled(self, f: impl FnOnce()) -> Self

Source§

impl EnteredTraceSpan for EnteredSpan

Source§

fn or_if_tracing_disabled(self, _f: impl FnOnce()) -> Self

Implementors§