19 releases

✓ Uses Rust 2018 edition

new 0.7.1 Dec 13, 2019
0.6.0 Nov 17, 2019
0.5.2 Jun 30, 2018
0.3.3 Jan 4, 2018
0.0.1 Nov 21, 2014

#27 in Command-line interface

Download history 396/week @ 2019-08-30 244/week @ 2019-09-06 188/week @ 2019-09-13 300/week @ 2019-09-20 184/week @ 2019-09-27 288/week @ 2019-10-04 223/week @ 2019-10-11 226/week @ 2019-10-18 393/week @ 2019-10-25 222/week @ 2019-11-01 504/week @ 2019-11-08 545/week @ 2019-11-15 1212/week @ 2019-11-22 1117/week @ 2019-11-29 882/week @ 2019-12-06

2,315 downloads per month
Used in 19 crates (12 directly)

MIT license

61KB
1.5K SLoC

pretty.rs

Build Status Docs

Pretty printing combinators for Rust

Synopsis

This crate provides functionality for defining pretty printers. It is particularly useful for printing structured recursive data like trees.

The implementation was originally based on Larsen's SML translation (https://github.com/kfl/wpp) of Wadler's Haskell pretty printer (https://homepages.inf.ed.ac.uk/wadler/papers/prettier/prettier.pdf). It has since been modified in various ways to better fit Rust's programming model. In particular, it uses iteration rather than recursion and provides streaming output.

Documentation

See the generated API documentation here.

Requirements

  1. Rust
  2. Cargo

You can install both with the following:

$ curl -s https://static.rust-lang.org/rustup.sh | sudo sh

See Installation for further details.

Usage

$ cargo build                                          ## build library and binary
$ cargo run --example trees                            ## run the example (pretty trees)
$ cargo run --example colored --features termcolor     ## run the example (pretty colored output)
$ cargo bench                                          ## run benchmarks
$ cargo test                                           ## run tests

Dependencies

~36KB