Expand description
Pretty-printing anything in the IR, from whole Module
s to their leaves.
Usage
To start, create a Plan
(through e.g. Plan::for_root
or Plan::for_module
),
which will track the entire (transitive) set of (interned/entity) dependencies
required to produce complete pretty-printing outputs.
On a Plan
, use .pretty_print()
to print everything,
and get a “pretty document”, with layout (inline-vs-multi-line decisions,
auto-indentation, etc.) already performed, and which supports outputting:
- plain text:
fmt::Display
({}
formatting) or.to_string()
- HTML (styled and hyperlinked):
.render_to_html()
(returning a [pretty::HtmlSnippet
])
Structs
- A
Print
Output
type that splits the attributes from the main body of the definition, allowing additional processing before they get concatenated. - “Definitions-before-uses” / “topo-sorted” printing plan.