Trait bevy::log::tracing_subscriber::fmt::FormatFields

pub trait FormatFields<'writer> {
    // Required method
    fn format_fields<R>(
        &self,
        writer: Writer<'writer>,
        fields: R,
    ) -> Result<(), Error>
       where R: RecordFields;

    // Provided method
    fn add_fields(
        &self,
        current: &'writer mut FormattedFields<Self>,
        fields: &Record<'_>,
    ) -> Result<(), Error> { ... }
}
Available on crate features fmt and std only.
Expand description

A type that can format a set of fields to a Writer.

FormatFields is primarily used in the context of FmtSubscriber. Each time a span or event with fields is recorded, the subscriber will format those fields with its associated FormatFields implementation.

Required Methods§

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.

Provided Methods§

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

Record additional field(s) on an existing span.

By default, this appends a space to the current set of fields if it is non-empty, and then calls self.format_fields. If different behavior is required, the default implementation of this method can be overridden.

Object Safety§

This trait is not object safe.

Implementors§

§

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

§

impl<'writer> FormatFields<'writer> for Pretty

§

impl<'writer, M> FormatFields<'writer> for M
where M: MakeOutput<Writer<'writer>, Result<(), Error>>, <M as MakeVisitor<Writer<'writer>>>::Visitor: VisitFmt + VisitOutput<Result<(), Error>>,