Trait tracing_subscriber::fmt::writer::MakeWriter [−][src]
pub trait MakeWriter { type Writer: Write; fn make_writer(&self) -> Self::Writer; }
This is supported on crate feature
fmt
only.Expand description
A type that can create io::Write
instances.
MakeWriter
is used by fmt::Subscriber
or fmt::Layer
to print formatted text representations of
Event
s.
This trait is already implemented for function pointers and immutably-borrowing closures that
return an instance of io::Write
, such as io::stdout
and io::stderr
.
Associated Types
The concrete io::Write
implementation returned by make_writer
.
Required methods
fn make_writer(&self) -> Self::Writer
[src]
fn make_writer(&self) -> Self::Writer
[src]Returns an instance of Writer
.
Implementer notes
fmt::Layer
or fmt::Subscriber
will call this method each time an event is recorded. Ensure any state
that must be saved across writes is not lost when the Writer
instance is dropped. If
creating a io::Write
instance is expensive, be sure to cache it when implementing
MakeWriter
to improve performance.