Trait tracing_subscriber::fmt::MakeWriter[][src]

pub trait MakeWriter {
    type Writer: Write;
    fn make_writer(&self) -> Self::Writer;
}
This is supported on crate feature fmt only.

A type that can create io::Write instances.

MakeWriter is used by fmt::Subscriber or fmt::Layer to print formatted text representations of Events.

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

type Writer: Write[src]

The concrete io::Write implementation returned by make_writer.

Loading content...

Required methods

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.

Loading content...

Implementors

impl MakeWriter for TestWriter[src]

type Writer = Self

impl MakeWriter for BoxMakeWriter[src]

type Writer = Box<dyn Write>

impl<F, W> MakeWriter for F where
    F: Fn() -> W,
    W: Write
[src]

type Writer = W

Loading content...