Trait tracing_subscriber::registry::LookupSpan[][src]

pub trait LookupSpan<'a> {
    type Data: SpanData<'a>;
    fn span_data(&'a self, id: &Id) -> Option<Self::Data>
Notable traits for Option<L>
impl<L, S> Layer<S> for Option<L> where
    L: Layer<S>,
    S: Subscriber
; fn span(&'a self, id: &Id) -> Option<SpanRef<'_, Self>>
Notable traits for Option<L>
impl<L, S> Layer<S> for Option<L> where
    L: Layer<S>,
    S: Subscriber

    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 Layers wrapping them can look up metadata via the Context type’s span() method.

Associated Types

The type of span data stored in this registry.

Required methods

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 sophisiticated queries.

Provided methods

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 registryr 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.

This is supported on crate feature registry only.

Registers a Filter for per-layer filtering with this Subscriber.

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

Panics

If this Subscriber does not support per-layer filtering.

Implementors