2 releases

Uses old Rust 2015

0.1.1 Jun 5, 2018
0.1.0 Dec 12, 2017

#1602 in Text processing

Download history 2503/week @ 2024-07-22 2866/week @ 2024-07-29 2897/week @ 2024-08-05 2277/week @ 2024-08-12 2985/week @ 2024-08-19 2708/week @ 2024-08-26 2577/week @ 2024-09-02 3339/week @ 2024-09-09 3113/week @ 2024-09-16 3726/week @ 2024-09-23 3026/week @ 2024-09-30 3139/week @ 2024-10-07 3385/week @ 2024-10-14 6421/week @ 2024-10-21 6999/week @ 2024-10-28 5037/week @ 2024-11-04

22,021 downloads per month
Used in 15 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