[][src]Trait tracing_error::ExtractSpanTrace

pub trait ExtractSpanTrace {
    fn span_trace(&self) -> Option<&SpanTrace>;
}
This is supported on feature="traced-error" only.

A trait for extracting SpanTraces created by in_current_span() from dyn Error trait objects

Required methods

fn span_trace(&self) -> Option<&SpanTrace>

This is supported on feature="traced-error" only.

Attempts to downcast to a TracedError and return a reference to its SpanTrace

Examples

use tracing_error::ExtractSpanTrace;
use std::error::Error;

fn print_span_trace(e: &(dyn Error + 'static)) {
    let span_trace = e.span_trace();
    if let Some(span_trace) = span_trace {
        println!("{}", span_trace);
    }
}
Loading content...

Implementations on Foreign Types

impl ExtractSpanTrace for dyn Error + 'static[src]

Loading content...

Implementors

Loading content...