notugly
Simple and generic pretty-printing library, heavily based on A prettier printer.
How to use
To define pretty-printing for a type, implement the Format trait using the various utility functions:
nilfor a null elementtextto create a string into a documentnestto indent a documentcatto concatenate two documentsgroupandgroup_withto add the flattened layout as an alternative.fold,spread,stackandfillto collapse a list of documents in various ways
To make it easier to define a structure, some operators are defined:
x & y == cat(x,y)x + y == x & text(" ") & yx / y == x & line() & yx * y == x & group(line) & y
See the examples/ directory for fully-featured examples.
Example : S-Expressions
use *;