Type Alias PrettyPrinter

Source
pub type PrettyPrinter = Printer<Pretty, MakeStdout>;
Expand description

A Processor that pretty-prints to stdout.

Aliased Type§

struct PrettyPrinter { /* private fields */ }

Implementations§

Source§

impl PrettyPrinter

Source

pub const fn new() -> Self

Returns a new PrettyPrinter that pretty-prints to stdout.

Use Printer::formatter and Printer::writer for custom configuration.

Source§

impl<F, W> Printer<F, W>
where F: 'static + Formatter, W: 'static + for<'a> MakeWriter<'a>,

Source

pub fn formatter<F2>(self, formatter: F2) -> Printer<F2, W>
where F2: 'static + Formatter,

Set the formatter.

See the Formatter trait for details on possible inputs.

Source

pub fn writer<W2>(self, make_writer: W2) -> Printer<F, W2>
where W2: 'static + for<'a> MakeWriter<'a>,

Set the writer.

Trait Implementations§

Source§

impl Default for PrettyPrinter

Source§

fn default() -> Self

Returns the “default value” for a type. Read more
Source§

impl<F: Clone, W: Clone> Clone for Printer<F, W>

Source§

fn clone(&self) -> Printer<F, W>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<F: Debug, W: Debug> Debug for Printer<F, W>

Source§

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

Formats the value using the given formatter. Read more
Source§

impl<F, W> Processor for Printer<F, W>
where F: 'static + Formatter, W: 'static + for<'a> MakeWriter<'a>,

Source§

fn process(&self, tree: Tree) -> Result

Process a Tree. This can mean many things, such as writing to stdout or a file, sending over a network, storing in memory, ignoring, or anything else. Read more
Source§

fn or<P: Processor>(self, processor: P) -> WithFallback<Self, P>

Returns a Processor that first attempts processing with self, and resorts to processing with fallback on failure. Read more
Source§

fn or_stdout(self) -> WithFallback<Self, Printer<Pretty, MakeStdout>>

Returns a Processor that first attempts processing with self, and resorts to pretty-printing to stdout on failure.
Source§

fn or_stderr(self) -> WithFallback<Self, Printer<Pretty, MakeStderr>>

Returns a Processor that first attempts processing with self, and resorts to pretty-printing to stderr on failure.
Source§

fn or_none(self) -> WithFallback<Self, Sink>

Returns a Processor that first attempts processing with self, otherwise silently fails.