Expand description
§FileSystemTree
FileSystemTree::build is faster than
MergeableFileSystemTree::build but it does not write over an existing
directory and it does not create parent directories when they don’t exist.
Example:
use build_fs_tree::{FileSystemTree, Build, dir, file};
let tree: FileSystemTree<&str, &str> = dir! {
"index.html" => file!(r#"
<!DOCTYPE html>
<link rel="stylesheet" href="styles/style.css" />
<script src="scripts/main.js"></script>
"#)
"scripts" => dir! {
"main.js" => file!(r#"document.write('Hello World')"#)
}
"styles" => dir! {
"style.css" => file!(r#":root { color: red; }"#)
}
};
tree.build("public").unwrap();§MergeableFileSystemTree
Unlike FileSystemTree::build, MergeableFileSystemTree::build
can write over an existing directory and create parent directories that were not exist before at the
cost of performance.
You can convert a FileSystemTree into a MergeableFileSystemTree via From::from/Into::into
and vice versa.
Example:
use build_fs_tree::{MergeableFileSystemTree, Build, dir, file};
let tree = MergeableFileSystemTree::<&str, &str>::from(dir! {
"public" => dir! {
"index.html" => file!(r#"
<!DOCTYPE html>
<link rel="stylesheet" href="styles/style.css" />
<script src="scripts/main.js"></script>
"#)
"scripts/main.js" => file!(r#"document.write('Hello World')"#)
"scripts/style.css" => file!(r#":root { color: red; }"#)
}
});
tree.build(".").unwrap();§Serialization and Deserialization
Both FileSystemTree and MergeableFileSystemTree implement serde::Deserialize
and serde::Serialize.
Re-exports§
pub use serde;pub use serde_yaml;
Macros§
Structs§
- Build
Error - Error caused by
Build::build. - Mergeable
File System Tree - Representation of a filesystem which contains only files and directories.
Enums§
- Failed
Operation - Operation that causes an error.
- File
System Tree - Representation of a filesystem which contains only files and directories.
- Node
Content - Content of a node in the filesystem tree
Traits§
- Build
- Applying
FileSystemTreeto the filesystem. - Node
- Node of a filesystem tree.
Functions§
- make_
mergeable_ dir_ content_ unmergeable - Transmute a
MergeableDirectoryContentinto aDirectoryContent. - make_
unmergeable_ dir_ content_ mergeable - Transmute a
DirectoryContentinto aMergeableDirectoryContent.
Type Aliases§
- Directory
Content - Directory content of
FileSystemTree. - Mergeable
Directory Content - Directory content of
MergeableFileSystemTree.