Docs.rs
  • build-fs-tree-0.7.1
    • build-fs-tree 0.7.1
    • Permalink
    • Docs.rs crate page
    • MIT
    • Links
    • Repository
    • crates.io
    • Source
    • Owners
    • KSXGitHub
    • Dependencies
      • clap ^4.5.16 normal optional
      • clap-utilities ^0.2.0 normal optional
      • derive_more ^1.0.0 normal
      • pipe-trait ^0.4.0 normal
      • serde ^1.0.208 normal
      • serde_yaml ^0.9.33 normal
      • text-block-macros ^0.1.1 normal
    • Versions
    • 100% of the crate is documented
  • Platform
    • i686-pc-windows-msvc
    • i686-unknown-linux-gnu
    • x86_64-apple-darwin
    • x86_64-pc-windows-msvc
    • x86_64-unknown-linux-gnu
  • Feature flags
  • docs.rs
    • About docs.rs
    • Privacy policy
  • Rust
    • Rust website
    • The Book
    • Standard Library API Reference
    • Rust by Example
    • The Cargo Guide
    • Clippy Documentation

Crate build_fs_tree

build_fs_tree0.7.1

  • All Items

Sections

  • FileSystemTree
  • MergeableFileSystemTree
  • Serialization and Deserialization

Crate Items

  • Re-exports
  • Macros
  • Structs
  • Enums
  • Traits
  • Functions
  • Type Aliases

Crates

  • build_fs_tree

Crate build_fs_tree

Source
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§

dir
Create representation of a directory.
file
Create representation of a file.

Structs§

BuildError
Error caused by Build::build.
MergeableFileSystemTree
Representation of a filesystem which contains only files and directories.

Enums§

FailedOperation
Operation that causes an error.
FileSystemTree
Representation of a filesystem which contains only files and directories.
NodeContent
Content of a node in the filesystem tree

Traits§

Build
Applying FileSystemTree to the filesystem.
Node
Node of a filesystem tree.

Functions§

make_mergeable_dir_content_unmergeable
Transmute a MergeableDirectoryContent into a DirectoryContent.
make_unmergeable_dir_content_mergeable
Transmute a DirectoryContent into a MergeableDirectoryContent.

Type Aliases§

DirectoryContent
Directory content of FileSystemTree.
MergeableDirectoryContent
Directory content of MergeableFileSystemTree.

Results

Settings
Help

Query parser error: "Unexpected - (did you mean ->?)".