Struct tracing_subscriber::fmt::format::Writer[][src]

pub struct Writer<'writer> { /* fields omitted */ }
This is supported on crate features fmt and std only.
Expand description

A writer to which formatted representations of spans and events are written.

This type is provided as input to the FormatEvent::format_event and FormatFields::format_fields methods, which will write formatted representations of Events and [fields] to the Writer.

This type implements the std::fmt::Write trait, allowing it to be used with any function that takes an instance of std::fmt::Write. Additionally, it can be used with the standard library’s std::write! and std::writeln! macros.

Additionally, a Writer may expose additional tracing-specific information to the formatter implementation.

Implementations

Return a new Writer that mutably borrows self.

This can be used to temporarily borrow a Writer to pass a new Writer to a function that takes a Writer by value, allowing the original writer to still be used once that function returns.

Writes a string slice into this Writer, returning whether the write succeeded.

This method can only succeed if the entire string slice was successfully written, and this method will not return until all data has been written or an error occurs.

This is identical to calling the write_str method from the Writer’s std::fmt::Write implementation. However, it is also provided as an inherent method, so that Writers can be used without needing to import the std::fmt::Write trait.

Errors

This function will return an instance of std::fmt::Error on error.

Writes a char into this writer, returning whether the write succeeded.

A single char may be encoded as more than one byte. This method can only succeed if the entire byte sequence was successfully written, and this method will not return until all data has been written or an error occurs.

This is identical to calling the write_char method from the Writer’s std::fmt::Write implementation. However, it is also provided as an inherent method, so that Writers can be used without needing to import the std::fmt::Write trait.

Errors

This function will return an instance of std::fmt::Error on error.

Glue for usage of the write! macro with Wrriters.

This method should generally not be invoked manually, but rather through the write! macro itself.

This is identical to calling the write_fmt method from the Writer’s std::fmt::Write implementation. However, it is also provided as an inherent method, so that Writers can be used with the [write! macro] without needing to import the std::fmt::Write trait.

Trait Implementations

Formats the value using the given formatter. Read more

The visitor type produced by this MakeVisitor.

Make a new visitor for the provided target.

The visitor type produced by this MakeVisitor.

Make a new visitor for the provided target.

The visitor type produced by this MakeVisitor.

Make a new visitor for the provided target.

Writes a string slice into this writer, returning whether the write succeeded. Read more

Writes a char into this writer, returning whether the write succeeded. Read more

Glue for usage of the write! macro with implementors of this trait. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Performs the conversion.

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

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

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.

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

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