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
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
//! Procedural macro for defining type-safe directory trees
use TokenStream;
use parse_macro_input;
use crateTreeDef;
/// Procedural macro for defining type-safe directory trees.
///
/// # Syntax
///
/// ```ignore
/// 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:
///
/// ```toml
/// [dependencies]
/// tree-type = "0.1"
/// tree-type-proc-macro = "0.1"
/// ```
/// Procedural macro for creating a simple file type.
///
/// Creates a type representing a single file with standard file operations.
/// Automatically includes serde derives when the serde feature is enabled.
///
/// # Example
///
/// ```ignore
/// file_type!(ConfigFile);
///
/// let config = ConfigFile::new("/etc/app/config.toml");
/// let contents = config.read_to_string()?;
/// ```
/// Procedural macro for creating a simple directory type.
///
/// Creates a type representing a directory with standard directory operations.
/// Automatically includes serde derives when the serde feature is enabled.
///
/// # Example
///
/// ```ignore
/// dir_type!(CacheDir);
///
/// let cache = CacheDir::new("/var/cache/app");
/// cache.create_all()?;
/// ```