Struct bevy::log::tracing_subscriber::fmt::FmtContext

pub struct FmtContext<'a, S, N> { /* private fields */ }
Available on crate features fmt and std only.
Expand description

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,

pub fn visit_spans<E, F>(&self, f: F) -> Result<(), E>
where F: FnMut(&SpanRef<'_, S>) -> 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.

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

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

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

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>,

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 current_span(&self) -> Current

Returns the current span for this formatter.

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.

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
Note: Compared to scope this
returns the spans in reverse order (from leaf to root). Use
Scope::from_root
in case root-to-leaf ordering is desired.
Note: This requires the wrapped subscriber to implement the
LookupSpan trait.
See the documentation on Context's
declaration for details.

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 to scope this
returns the spans in reverse order (from leaf to root). Use
Scope::from_root
in case root-to-leaf ordering is desired.
Note: This requires the wrapped subscriber to implement the
LookupSpan trait.
See the documentation on Context's
declaration for details.

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§

§

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

§

fn fmt(&self, f: &mut Formatter<'_>) -> Result<(), Error>

Formats the value using the given formatter. Read more
§

impl<'cx, 'writer, S, N> FormatFields<'writer> for FmtContext<'cx, S, N>
where S: Subscriber + for<'lookup> LookupSpan<'lookup>, N: FormatFields<'writer> + 'static,

§

fn format_fields<R>( &self, writer: Writer<'writer>, fields: R ) -> Result<(), Error>
where R: RecordFields,

Format the provided fields to the provided Writer, returning a result.
§

fn add_fields( &self, current: &'writer mut FormattedFields<Self>, fields: &Record<'_> ) -> Result<(), Error>

Record additional field(s) on an existing span. Read more

Auto Trait Implementations§

§

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

§

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> Any for T
where T: 'static + ?Sized,

source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
§

impl<T, U> AsBindGroupShaderType<U> for T
where U: ShaderType, &'a T: for<'a> Into<U>,

§

fn as_bind_group_shader_type(&self, _images: &RenderAssets<GpuImage>) -> U

Return the T ShaderType for self. When used in AsBindGroup derives, it is safe to assume that all images in self exist.
source§

impl<T> Borrow<T> for T
where T: ?Sized,

source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
§

impl<T> Downcast<T> for T

§

fn downcast(&self) -> &T

§

impl<T> Downcast for T
where T: Any,

§

fn into_any(self: Box<T>) -> Box<dyn Any>

Convert 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.
§

fn into_any_rc(self: Rc<T>) -> Rc<dyn Any>

Convert Rc<Trait> (where Trait: Downcast) to Rc<Any>. Rc<Any> can then be further downcast into Rc<ConcreteType> where ConcreteType implements Trait.
§

fn as_any(&self) -> &(dyn Any + 'static)

Convert &Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &Any’s vtable from &Trait’s.
§

fn as_any_mut(&mut self) -> &mut (dyn Any + 'static)

Convert &mut Trait (where Trait: Downcast) to &Any. This is needed since Rust cannot generate &mut Any’s vtable from &mut Trait’s.
source§

impl<T> From<T> for T

source§

fn from(t: T) -> T

Returns the argument unchanged.

§

impl<S> FromSample<S> for S

§

fn from_sample_(s: S) -> S

§

impl<T> Instrument for T

§

fn instrument(self, span: Span) -> Instrumented<Self>

Instruments this type with the provided Span, returning an Instrumented wrapper. Read more
§

fn in_current_span(self) -> Instrumented<Self>

Instruments this type with the current Span, returning an Instrumented wrapper. Read more
source§

impl<T, U> Into<U> for T
where U: From<T>,

source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

source§

impl<T> IntoEither for T

source§

fn into_either(self, into_left: bool) -> Either<Self, Self>

Converts self into a Left variant of Either<Self, Self> if into_left is true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

Converts self into a Left variant of Either<Self, Self> if into_left(&self) returns true. Converts self into a Right variant of Either<Self, Self> otherwise. Read more
§

impl<F, T> IntoSample<T> for F
where T: FromSample<F>,

§

fn into_sample(self) -> T

§

impl<T> Pointable for T

§

const ALIGN: usize = _

The alignment of pointer.
§

type Init = T

The type for initializers.
§

unsafe fn init(init: <T as Pointable>::Init) -> usize

Initializes a with the given initializer. Read more
§

unsafe fn deref<'a>(ptr: usize) -> &'a T

Dereferences the given pointer. Read more
§

unsafe fn deref_mut<'a>(ptr: usize) -> &'a mut T

Mutably dereferences the given pointer. Read more
§

unsafe fn drop(ptr: usize)

Drops the object pointed to by the given pointer. Read more
source§

impl<T> Same for T

§

type Output = T

Should always be Self
§

impl<T, U> ToSample<U> for T
where U: FromSample<T>,

§

fn to_sample_(self) -> U

source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

§

type Error = Infallible

The type returned in the event of a conversion error.
source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

§

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

The type returned in the event of a conversion error.
source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.
§

impl<T> Upcast<T> for T

§

fn upcast(&self) -> Option<&T>

§

impl<V, T> VZip<V> for T
where V: MultiLane<T>,

§

fn vzip(self) -> V

§

impl<T> WithSubscriber for T

§

fn with_subscriber<S>(self, subscriber: S) -> WithDispatch<Self>
where S: Into<Dispatch>,

Attaches the provided Subscriber to this type, returning a WithDispatch wrapper. Read more
§

fn with_current_subscriber(self) -> WithDispatch<Self>

Attaches the current default Subscriber to this type, returning a WithDispatch wrapper. Read more
§

impl<S, T> Duplex<S> for T
where T: FromSample<S> + ToSample<S>,