Struct bevy::log::tracing_subscriber::fmt::FmtContext
source · pub struct FmtContext<'a, S, N> { /* private fields */ }
Expand description
Provides the current span context to a formatter.
Implementations§
source§impl<'a, S, N> FmtContext<'a, S, N>where
S: Subscriber + for<'lookup> LookupSpan<'lookup>,
N: for<'writer> FormatFields<'writer> + 'static,
impl<'a, S, N> FmtContext<'a, S, N>where
S: Subscriber + for<'lookup> LookupSpan<'lookup>,
N: for<'writer> FormatFields<'writer> + 'static,
sourcepub fn visit_spans<E, F>(&self, f: F) -> Result<(), E>
pub fn visit_spans<E, F>(&self, f: F) -> Result<(), E>
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.
sourcepub fn metadata(&self, id: &Id) -> Option<&'static Metadata<'static>>where
S: for<'lookup> LookupSpan<'lookup>,
pub fn metadata(&self, id: &Id) -> Option<&'static Metadata<'static>>where
S: for<'lookup> LookupSpan<'lookup>,
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).
sourcepub fn span(&self, id: &Id) -> Option<SpanRef<'_, S>>where
S: for<'lookup> LookupSpan<'lookup>,
pub fn span(&self, id: &Id) -> Option<SpanRef<'_, S>>where
S: for<'lookup> LookupSpan<'lookup>,
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).
sourcepub fn exists(&self, id: &Id) -> boolwhere
S: for<'lookup> LookupSpan<'lookup>,
pub fn exists(&self, id: &Id) -> boolwhere
S: for<'lookup> LookupSpan<'lookup>,
Returns true
if an active span exists for the given Id
.
sourcepub fn lookup_current(&self) -> Option<SpanRef<'_, S>>where
S: for<'lookup> LookupSpan<'lookup>,
pub fn lookup_current(&self) -> Option<SpanRef<'_, S>>where
S: for<'lookup> LookupSpan<'lookup>,
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.
sourcepub fn current_span(&self) -> Current
pub fn current_span(&self) -> Current
Returns the current span for this formatter.
sourcepub fn parent_span(&self) -> Option<SpanRef<'_, S>>
pub fn parent_span(&self) -> Option<SpanRef<'_, S>>
Returns stored data for the parent span of the event currently being formatted.
If the event has a contextual parent, this will return the current span. If
the event has an explicit parent span, this will return that span. If
the event does not have a parent span, this will return None
.
sourcepub fn span_scope(&self, id: &Id) -> Option<Scope<'_, S>>where
S: for<'lookup> LookupSpan<'lookup>,
pub fn span_scope(&self, id: &Id) -> Option<Scope<'_, S>>where
S: for<'lookup> LookupSpan<'lookup>,
Returns an iterator over the stored data for all the spans in the current context, starting with the specified span and ending with the root of the trace tree and ending with the current span.
This is equivalent to the Context::span_scope
method.
Note: Compared toscope
this returns the spans in reverse order (from leaf to root). UseScope::from_root
in case root-to-leaf ordering is desired.
Note: This requires the wrapped subscriber to implement theLookupSpan
trait. See the documentation onContext
's declaration for details.
sourcepub fn event_scope(&self) -> Option<Scope<'_, S>>where
S: for<'lookup> LookupSpan<'lookup>,
pub fn event_scope(&self) -> Option<Scope<'_, S>>where
S: for<'lookup> LookupSpan<'lookup>,
Returns an iterator over the stored data for all the spans in the event’s span context, starting with its parent span and ending with the root of the trace tree.
This is equivalent to calling the Context::event_scope
method and
passing the event currently being formatted.
Note: Compared toscope
this returns the spans in reverse order (from leaf to root). UseScope::from_root
in case root-to-leaf ordering is desired.
Note: This requires the wrapped subscriber to implement theLookupSpan
trait. See the documentation onContext
's declaration for details.
sourcepub fn field_format(&self) -> &N
pub fn field_format(&self) -> &N
Returns the field formatter configured by the subscriber invoking
format_event
.
The event formatter may use the returned field formatter to format the fields of any events it records.
Trait Implementations§
source§impl<'a, S, N> Debug for FmtContext<'a, S, N>
impl<'a, S, N> Debug for FmtContext<'a, S, N>
source§impl<'cx, 'writer, S, N> FormatFields<'writer> for FmtContext<'cx, S, N>
impl<'cx, 'writer, S, N> FormatFields<'writer> for FmtContext<'cx, S, N>
source§fn format_fields<R>(
&self,
writer: Writer<'writer>,
fields: R
) -> Result<(), Error>where
R: RecordFields,
fn format_fields<R>(
&self,
writer: Writer<'writer>,
fields: R
) -> Result<(), Error>where
R: RecordFields,
fields
to the provided Writer
, returning a result.source§fn add_fields(
&self,
current: &'writer mut FormattedFields<Self>,
fields: &Record<'_>
) -> Result<(), Error>
fn add_fields( &self, current: &'writer mut FormattedFields<Self>, fields: &Record<'_> ) -> Result<(), Error>
Auto Trait Implementations§
impl<'a, S, N> !RefUnwindSafe for FmtContext<'a, S, N>
impl<'a, S, N> !Send for FmtContext<'a, S, N>
impl<'a, S, N> !Sync for FmtContext<'a, S, N>
impl<'a, S, N> Unpin for FmtContext<'a, S, N>
impl<'a, S, N> !UnwindSafe for FmtContext<'a, S, N>
Blanket Implementations§
source§impl<T, U> AsBindGroupShaderType<U> for T
impl<T, U> AsBindGroupShaderType<U> for T
source§fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
fn as_bind_group_shader_type(&self, _images: &RenderAssets<Image>) -> U
T
ShaderType
for self
. When used in AsBindGroup
derives, it is safe to assume that all images in self
exist.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
source§impl<T> Downcast for Twhere
T: Any,
impl<T> Downcast for Twhere
T: Any,
source§fn into_any(self: Box<T>) -> Box<dyn Any>
fn into_any(self: Box<T>) -> Box<dyn Any>
Box<dyn Trait>
(where Trait: Downcast
) to Box<dyn Any>
. Box<dyn Any>
can
then be further downcast
into Box<ConcreteType>
where ConcreteType
implements Trait
.source§fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>
Rc<Trait>
(where Trait: Downcast
) to Rc<Any>
. Rc<Any>
can then be
further downcast
into Rc<ConcreteType>
where ConcreteType
implements Trait
.source§fn as_any(&self) -> &(dyn Any + 'static)
fn as_any(&self) -> &(dyn Any + 'static)
&Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &Any
’s vtable from &Trait
’s.source§fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)
&mut Trait
(where Trait: Downcast
) to &Any
. This is needed since Rust cannot
generate &mut Any
’s vtable from &mut Trait
’s.