Crates.io | fs-tree |
lib.rs | fs-tree |
version | 0.5.5 |
source | src |
created_at | 2020-02-10 23:20:14.89368 |
updated_at | 2023-10-03 22:47:51.260426 |
description | Filesystem path Trie with an API focused on filesystem operations. |
homepage | |
repository | https://github.com/marcospb19/fs-tree |
max_upload_size | |
id | 207192 |
size | 69,150 |
FsTree
is a path Trie with an API focused on filesystem operations.
0.1.3
, and changed its purpose.ext4
or btrfs
).A FsTree
is a node with three possible file types:
use std::{collections::BTreeMap, path::PathBuf};
pub enum FsTree {
Regular,
Directory(TrieMap), // Recursive part
Symlink(PathBuf),
}
// ↓↓
pub type TrieMap = BTreeMap<PathBuf, FsTree>; // Recursive part
The root of the FsTree
is unnamed (no filename/path), the "edges" to children are the
relative paths.
Like std
functions, functions in this crate follow symlinks (and symlink chains), so you'll
never get a FsTree::Symlink(_)
in your tree! If you want symlink-awareness, use the function
version with the symlink
prefix (FsTree::read_at
vs FsTree::symlink_read_at
).
FsTree
:FsTree::symlink_read_at
)FsTree
literal. (tree!
)FsTree::new_dir
+ FsTree::insert
)FsTree::from_path_text
)FsTree
:FsTree::try_merge
)FsTree::write_at
)FsTree::read_copy_at
)FsTree
, generating a DiffTree.See docs in the iter
module.
walkdir
- Better if you just need to iterate on
filesystem trees.file_type_enum
- If you want a shallow type enum.build-fs-tree
- If you need to create a
filesystem tree from a YAML file.
tree!
, and writing
with FsTree::write_at
.