summaryrefslogtreecommitdiff
path: root/morphology/examples/pretty_print_demo.rs
blob: 27609621a478bd3ffff5d68ff3338df418a09614 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
//! Demonstration of the pretty_print function
//!
//! Compile and run:
//!   cargo run --example pretty_print_demo

use meta_affine::Value;

fn main() {
    println!("Pretty Print Demonstration\n");
    println!("{}", "=".repeat(50));

    let examples = vec![
        (0, 0),
        (0, 1),
        (1, 0),
        (-1, 0),
        (1, 3),
        (2, 1),
        (-3, 2),
        (5, 7),
        (-5, 7),
        (4, -8),
        (-4, -8),
    ];

    for (outer, inner) in examples {
        let value = Value::new(outer, inner);
        println!(
            "{:10} -> {}",
            format!("{}", value),
            value.pretty_print()
        );
    }

    println!("{}", "=".repeat(50));
}