[][src]Trait opentelemetry::api::trace::tracer::TracerGenerics

pub trait TracerGenerics: Tracer {
    fn with_span<T, F>(&self, name: &'static str, f: F) -> T
    where
        F: FnOnce(&mut Self::Span) -> T
; }

TracerGenerics are functions that have generic type parameters. They are a separate trait so that Tracer can be used as a trait object in GlobalTracer.

Required methods

fn with_span<T, F>(&self, name: &'static str, f: F) -> T where
    F: FnOnce(&mut Self::Span) -> T, 

Wraps the execution of the function body with a span. It starts a new span and sets it as the active span for the given function. It then executes the body. It closes the span before returning the execution result.

Loading content...

Implementors

impl<S: Tracer> TracerGenerics for S[src]

fn with_span<T, F>(&self, name: &'static str, f: F) -> T where
    F: FnOnce(&mut Self::Span) -> T, 
[src]

Wraps the execution of the function body with a span. It starts a new span and sets it as the active span for the given function. It then executes the body. It closes the span before returning the execution result.

Loading content...