4 releases
0.1.4 | Jun 26, 2024 |
---|---|
0.1.3 | Jun 26, 2024 |
0.1.2 | Jun 26, 2024 |
0.1.1 | Jun 26, 2024 |
0.1.0 |
|
#966 in Filesystem
4KB
dir_tree
Generate a JSON tree based on the provided path
Example
File structure:
/
L src/
L lib.rs
let res = generate_directory_tree("./src");
assert_eq!(serde_json::to_string(&res), r#"{"/":["lib.rs"]}"#);
File structure:
/
L src/
L baz/
L page.rs
L foo/
L bar/
L page.rs
L page.rs
L 404.rs
L layout.rs
L page.rs
let res = generate_directory_tree("./src");
assert_eq!(serde_json::to_pretty_string(&res), r#"
{
"/": [
"404.rs",
"layout.rs",
"page.rs"
],
"/baz": [
"page.rs"
],
"/foo": [
"page.rs"
],
"/foo/bar": [
"page.rs"
]
}"#);
Dependencies
~0.1–6.5MB
~36K SLoC