Crate pretty_print

Source
Expand description

This crate defines a Wadler-style pretty-printing API.

Start with the static functions of Doc.

§Quick start

Let’s pretty-print simple sexps! We want to pretty print sexps like

(1 2 3)

or, if the line would be too long, like

((1)
 (2 3)
 (4 5 6))

A simple symbolic expression consists of a numeric atom or a nested ordered list of symbolic expression children.

Modules§

helpers

Macros§

docs
Concatenates a number of documents (or values that can be converted into a document via the Pretty trait, like &str)

Structs§

AnsiStyle
The definition of the ANSI styles.
AnsiWriter
A writer that supports ANSI escape codes.
BufferWrite
Represents a terminal writer.
FmtWrite
Writes to something implementing std::fmt::Write
IoWrite
Writes to something implementing std::io::Write
PrettyFormatter
The given text, which must not contain line breaks.
PrettyProvider
Represents a pretty-printable tree provider.
TerminalWriter
Represents a terminal writer.

Enums§

AnsiAbility
The ability of a writer to support ANSI escape codes.
AnsiColor
The definition of the ANSI colors.
PrettyTree
The concrete document type. This type is not meant to be used directly. Instead use the static functions on Doc or the methods on an DocAllocator.

Traits§

PrettyBuilder
The PrettyPrint trait is implemented by types that can be pretty-printed.
PrettyPrint
Marker trait for types that can be pretty printed.
Render
Trait representing the operations necessary to render a document
RenderAnnotated
Trait representing the operations necessary to write an annotated document.