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
/// File descriptors and write modes
use std path PathBuf;
/// Write mode for file generation.
///
/// Determines how generated content should be written to the target file.
///
/// # Variants
///
/// - `Rewrite`: Completely replace existing file content
/// - `TomlExtend`: Smart merge with existing TOML file (preserves comments and order)
///
/// # Examples
///
/// ```rust
/// use genfile_core::WriteMode;
///
/// // For code generation - replace entire file
/// let mode = WriteMode::Rewrite;
///
/// // For configuration files - merge intelligently
/// let mode = WriteMode::TomlExtend;
/// ```
/// File descriptor for template materialization.
///
/// Specifies where to read the template from, where to write the output,
/// and how to handle existing content.
///
/// # Fields
///
/// - `file_path`: Destination path for generated file
/// - `template_path`: Source template file path
/// - `write_mode`: How to handle existing file content
///
/// # Examples
///
/// ```rust
/// use genfile_core::{ FileDescriptor, WriteMode };
/// use std::path::PathBuf;
///
/// let descriptor = FileDescriptor
/// {
/// file_path: PathBuf::from( "src/generated.rs" ),
/// template_path: PathBuf::from( "templates/module.hbs" ),
/// write_mode: WriteMode::Rewrite,
/// };
/// ```