1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
//! # [`FileSystemTree`]
//!
//! [`FileSystemTree::build`](Build::build) is faster than
//! [`MergeableFileSystemTree::build`](MergeableFileSystemTree) but it does not write over an existing
//! directory and it does not create parent directories when they don't exist.
//!
//! **Example:**
//!
//! ```no_run
//! 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".into()).unwrap();
//! ```
//!
//! # [`MergeableFileSystemTree`]
//!
//! Unlike [`FileSystemTree::build`](FileSystemTree), [`MergeableFileSystemTree::build`](Build::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:**
//!
//! ```no_run
//! 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(&".".into()).unwrap();
//! ```
//!
//! # Serialization and Deserialization
//!
//! Both [`FileSystemTree`] and [`MergeableFileSystemTree`] implement [`serde::Deserialize`]
//! and [`serde::Serialize`].

#![deny(warnings)]

mod build;
mod macros;
mod node;
mod tree;

pub use build::*;
pub use macros::*;
pub use node::*;
pub use tree::*;

#[cfg(feature = "cli")]
pub mod program;

pub use serde;
pub use serde_yaml;