pub struct Context<'a, N> { /* private fields */ }
Expand description
Represents the Subscriber
’s view of the current span context to a
formatter.
Implementations§
Source§impl<'a, N> Context<'a, N>
impl<'a, N> Context<'a, N>
Sourcepub fn visit_spans<F, E>(&self, f: F) -> Result<(), E>
pub fn visit_spans<F, E>(&self, f: F) -> Result<(), E>
Applies a function to each span in the current trace context.
The function is applied in order, beginning with the root of the trace, and ending with the current span. If the function returns an error, this will short-circuit.
If invoked from outside of a span, the function will not be applied.
Note that if we are currently unwinding, this will do nothing, rather than potentially causing a double panic.
Sourcepub fn with_current<F, R>(&self, f: F) -> Option<R>
pub fn with_current<F, R>(&self, f: F) -> Option<R>
Executes a closure with the reference to the current span.
Sourcepub fn new_visitor<'writer>(
&self,
writer: &'writer mut dyn Write,
is_empty: bool,
) -> <N as NewVisitor<'writer>>::Visitorwhere
N: NewVisitor<'writer>,
pub fn new_visitor<'writer>(
&self,
writer: &'writer mut dyn Write,
is_empty: bool,
) -> <N as NewVisitor<'writer>>::Visitorwhere
N: NewVisitor<'writer>,
Returns a new visitor that formats span fields to the provided writer. The visitor configuration is provided by the subscriber.
Trait Implementations§
Auto Trait Implementations§
impl<'a, N> Freeze for Context<'a, N>
impl<'a, N> RefUnwindSafe for Context<'a, N>where
N: RefUnwindSafe,
impl<'a, N> Send for Context<'a, N>where
N: Sync,
impl<'a, N> Sync for Context<'a, N>where
N: Sync,
impl<'a, N> Unpin for Context<'a, N>
impl<'a, N> UnwindSafe for Context<'a, N>where
N: RefUnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more