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
//! Function to read and write a TOML configuration file
/**
* toml_config.rs
*
* (C) Copyright 2026 AtlantisOS Project
* by @NachtsternBuild
*
* License: GNU GENERAL PUBLIC LICENSE Version 3
*/
use ;
use HashMap;
/// Structure the strings for saving configurations
/// Function that set the key-value pair and save the file
/// ### Usage:
///
/// ```rust
/// fn main() {
/// match get_config("atl_test", "theme") {
/// Some(val) => println!("Found: {}", val),
/// None => println!("Key not found!"),
/// }
/// }
/// ```
/// Function that read a value to a key from the configuration file
/// ### Usage:
///
/// ```rust
/// fn main() {
/// if let Err(e) = set_config("atl_test", "theme", "dark") {
/// eprintln!("Error at saving: {}", e);
/// }
/// set_config_val("atl_test", "port", "8080").unwrap();
/// let port: u16 = get_config_val("port")
/// .and_then(|v| v.parse().ok())
/// .unwrap_or(3000); // default value
/// println!("Port: {}", port);
/// }
/// ```