[][src]Struct tracing_subscriber::fmt::FmtContext

pub struct FmtContext<'a, S, N> { /* fields omitted */ }
This is supported on feature="fmt" only.

Provides the current span context to a formatter.

Implementations

impl<'a, S, N> FmtContext<'a, S, N> where
    S: Subscriber + for<'lookup> LookupSpan<'lookup>,
    N: for<'writer> FormatFields<'writer> + 'static, 
[src]

pub fn visit_spans<E, F>(&self, f: F) -> Result<(), E> where
    F: FnMut(&SpanRef<S>) -> Result<(), E>, 
[src]

This is supported on feature="fmt" only.

Visits every span in the current context with a closure.

The provided closure will be called first with the current span, and then with that span's parent, and then that span's parent, and so on until a root span is reached.

pub fn metadata(&self, id: &Id) -> Option<&'static Metadata<'static>> where
    S: for<'lookup> LookupSpan<'lookup>, 
[src]

This is supported on feature="fmt" only.

Returns metadata for the span with the given id, if it exists.

If this returns None, then no span exists for that ID (either it has closed or the ID is invalid).

pub fn span(&self, id: &Id) -> Option<SpanRef<S>> where
    S: for<'lookup> LookupSpan<'lookup>, 
[src]

This is supported on feature="fmt" only.

Returns stored data for the span with the given id, if it exists.

If this returns None, then no span exists for that ID (either it has closed or the ID is invalid).

pub fn exists(&self, id: &Id) -> bool where
    S: for<'lookup> LookupSpan<'lookup>, 
[src]

This is supported on feature="fmt" only.

Returns true if an active span exists for the given Id.

pub fn lookup_current(&self) -> Option<SpanRef<S>> where
    S: for<'lookup> LookupSpan<'lookup>, 
[src]

This is supported on feature="fmt" only.

Returns stored data for the span that the wrapped subscriber considers to be the current.

If this returns None, then we are not currently within a span.

pub fn scope(&self) -> Scope<S>

Important traits for Scope<'a, L>

impl<'a, L: LookupSpan<'a>> Iterator for Scope<'a, L> type Item = SpanRef<'a, L>;
where
    S: for<'lookup> LookupSpan<'lookup>, 
[src]

This is supported on feature="fmt" only.

Returns an iterator over the stored data for all the spans in the current context, starting the root of the trace tree and ending with the current span.

Trait Implementations

impl<'a, S, N> Debug for FmtContext<'a, S, N>[src]

impl<'a, S, N> FormatFields<'a> for FmtContext<'a, S, N> where
    S: Subscriber + for<'lookup> LookupSpan<'lookup>,
    N: for<'writer> FormatFields<'writer> + 'static, 
[src]

Auto Trait Implementations

impl<'a, S, N> RefUnwindSafe for FmtContext<'a, S, N> where
    N: RefUnwindSafe,
    S: RefUnwindSafe

impl<'a, S, N> Send for FmtContext<'a, S, N> where
    N: Sync,
    S: Sync

impl<'a, S, N> Sync for FmtContext<'a, S, N> where
    N: Sync,
    S: Sync

impl<'a, S, N> Unpin for FmtContext<'a, S, N>

impl<'a, S, N> UnwindSafe for FmtContext<'a, S, N> where
    N: RefUnwindSafe,
    S: RefUnwindSafe

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<'writer, M> FormatFields<'writer> for M where
    M: MakeOutput<&'writer mut (dyn Write + 'writer), Result<(), Error>>,
    <M as MakeVisitor<&'writer mut (dyn Write + 'writer)>>::Visitor: VisitFmt,
    <M as MakeVisitor<&'writer mut (dyn Write + 'writer)>>::Visitor: VisitOutput<Result<(), Error>>, 
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.