2 releases

Uses old Rust 2015

0.1.1 Jun 5, 2018
0.1.0 Dec 12, 2017

#1959 in Text processing

Download history 2555/week @ 2024-11-17 2316/week @ 2024-11-24 2414/week @ 2024-12-01 2568/week @ 2024-12-08 2847/week @ 2024-12-15 1616/week @ 2024-12-22 1327/week @ 2024-12-29 2198/week @ 2025-01-05 2769/week @ 2025-01-12 2707/week @ 2025-01-19 2546/week @ 2025-01-26 3386/week @ 2025-02-02 2737/week @ 2025-02-09 2420/week @ 2025-02-16 2904/week @ 2025-02-23 2654/week @ 2025-03-02

11,051 downloads per month
Used in 16 crates (9 directly)

MIT license

6KB

Crate to write an ascii tree.

 let l1 = Leaf(vec![String::from("line1"), String::from("line2"), String::from("line3"), String::from("line4")]);
 let l2 = Leaf(vec![String::from("only one line")]);
 let n1 = Node(String::from("node 1"), vec![l1.clone(), l2.clone()]);
 let n2 = Node(String::from("node 2"), vec![l2.clone(), l1.clone(), l2.clone()]);
 let n3 = Node(String::from("node 3"), vec![n1.clone(), l1.clone(), l2.clone()]);
 let n4 = Node(String::from("node 4"), vec![n1, n2, n3]);

 let mut output = String::new();
 let _ = write_tree(&mut output, &n4);

The result would be:

 node 4
 ├─ node 1
 │  ├─ line1
 │  │  line2
 │  │  line3
 │  │  line4
 │  └─ only one line
 ├─ node 2
 │  ├─ only one line
 │  ├─ line1
 │  │  line2
 │  │  line3
 │  │  line4
 │  └─ only one line
 └─ node 3
    ├─ node 1
    │  ├─ line1
    │  │  line2
    │  │  line3
    │  │  line4
    │  └─ only one line
    ├─ line1
    │  line2
    │  line3
    │  line4
    └─ only one line

No runtime deps