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
// Copyright notice and licensing information.
// These lines indicate the copyright of the software and its licensing terms.
// SPDX-License-Identifier: Apache-2.0 OR MIT indicates dual licensing under Apache 2.0 or MIT licenses.
// Copyright © 2023-2024 LibMake. All rights reserved.
//! # Example: Generating Templates from a TOML File
//!
//! This is a simple example that demonstrates how to generate template files
//! based on configuration stored in a TOML file using the `generate_from_toml`
//! function.
//!
//! ## Usage
//!
//! To run this example, make sure you have a valid TOML configuration file
//! at the specified path. The example will attempt to generate template files
//! based on the configuration. If generation fails, it will print an error
//! message.
//!
//! ```rust
//! // Import the necessary function for generating templates from a TOML file.
//! use libmake::generator::generate_from_toml;
//!
//! // Define the path to the TOML file containing configuration.
//! let toml_file_path = "./tests/data/mylibrary.toml"
//! // Generate template files based on the configuration in the TOML file.
//! // If generation fails, it will print an error message.
//! generate_from_toml(toml_file_path)
//! .expect("Failed to generate the template files");
//! ```
//!
// Import the necessary function for generating templates from a TOML file.
use generate_from_toml;
/// Generate template files based on the configuration in the TOML file.
///
/// # Arguments
///
/// * `toml_file_path` - Path to the TOML file containing the configuration.
///
/// # Returns
///
/// * `Result<(), String>` - Returns `Ok(())` if the template files are generated successfully, or returns an error message if generation fails.
///
pub