🛈 Note: This is pre-release documentation for the upcoming tracing 0.2.0 ecosystem.

For the release documentation, please see docs.rs, instead.

pub trait LookupSpan<'a> {
    type Data: SpanData<'a>;

    // Required method
    fn span_data(&'a self, id: &Id) -> Option<Self::Data> ;

    // Provided methods
    fn span(&'a self, id: &Id) -> Option<SpanRef<'_, Self>> 
       where Self: Sized { ... }
    fn register_filter(&mut self) -> FilterId { ... }
}
Expand description

Provides access to stored span data.

Subscribers which store span data and associate it with span IDs should implement this trait; if they do, any Subscribers wrapping them can look up metadata via the Context type’s span() method.

Required Associated Types§

source

type Data: SpanData<'a>

The type of span data stored in this registry.

Required Methods§

source

fn span_data(&'a self, id: &Id) -> Option<Self::Data>

Returns the SpanData for a given Id, if it exists.

Note: users of the LookupSpan trait should typically call the span method rather than this method. The span method is implemented by calling span_data, but returns a reference which is capable of performing more sophisticated queries.

Provided Methods§

source

fn span(&'a self, id: &Id) -> Option<SpanRef<'_, Self>>
where Self: Sized,

Returns a SpanRef for the span with the given Id, if it exists.

A SpanRef is similar to SpanData, but it allows performing additional lookups against the registry that stores the wrapped data.

In general, users of the LookupSpan trait should use this method rather than the span_data method; while implementors of this trait should only implement span_data.

source

fn register_filter(&mut self) -> FilterId

Available on crate feature registry only.

Registers a Filter for per-subscriber filtering with this collector.

The Filter can then use the returned FilterId to check if it previously enabled a span.

§Panics

If this collector does not support per-subscriber filtering.

Implementations on Foreign Types§

source§

impl<'a, S> LookupSpan<'a> for Box<S>
where S: LookupSpan<'a>,

Available on crate features alloc or std only.
§

type Data = <S as LookupSpan<'a>>::Data

source§

fn span_data(&'a self, id: &Id) -> Option<Self::Data>

source§

fn span(&'a self, id: &Id) -> Option<SpanRef<'_, Self>>
where Self: Sized,

source§

impl<'a, S> LookupSpan<'a> for Arc<S>
where S: LookupSpan<'a>,

Available on crate features alloc or std only.
§

type Data = <S as LookupSpan<'a>>::Data

source§

fn span_data(&'a self, id: &Id) -> Option<Self::Data>

source§

fn span(&'a self, id: &Id) -> Option<SpanRef<'_, Self>>
where Self: Sized,

Implementors§

source§

impl<'a> LookupSpan<'a> for Registry

Available on crate features registry and std only.
§

type Data = Data<'a>

source§

impl<'a, N, E, F, W> LookupSpan<'a> for Collector<N, E, F, W>
where Layered<F, Formatter<N, E, W>>: LookupSpan<'a>,

Available on crate features fmt and std only.
§

type Data = <Layered<F, Layered<Subscriber<Registry, N, E, W>, Registry>> as LookupSpan<'a>>::Data

source§

impl<'a, S, C> LookupSpan<'a> for Layered<S, C>
where C: Collect + LookupSpan<'a>,

§

type Data = <C as LookupSpan<'a>>::Data