summaryrefslogtreecommitdiff
path: root/morphology/examples
diff options
context:
space:
mode:
Diffstat (limited to 'morphology/examples')
-rw-r--r--morphology/examples/pretty_print_demo.rs36
1 files changed, 36 insertions, 0 deletions
diff --git a/morphology/examples/pretty_print_demo.rs b/morphology/examples/pretty_print_demo.rs
new file mode 100644
index 0000000..2760962
--- /dev/null
+++ b/morphology/examples/pretty_print_demo.rs
@@ -0,0 +1,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));
+}