tree_type

Macro tree_type 

Source
tree_type!() { /* proc-macro */ }
Expand description

Procedural macro for defining type-safe directory trees.

§Syntax

tree_type! {
    RootName => {
        file_name,
        file_with_custom("custom.txt"),
        dir_name/ => {
            nested_file
        },
        [id: String] => DynamicDir => {
            content
        }
    }
}

§Attributes

  • #[required] - Path must exist during validation
  • #[optional] - Path is optional (default behavior)
  • #[default] - Create with default content
  • #[validate(fn)] - Custom validation function
  • #[pattern(regex)] - Regex validation (requires pattern-validation feature)
  • #[symlink(target)] - Create symlink to target

§Note

This macro generates code that references types from the tree-type crate. Make sure to add both crates as dependencies:

[dependencies]
tree-type = "0.1"
tree-type-proc-macro = "0.1"