| Crates.io | config_toml |
| lib.rs | config_toml |
| version | 0.1.0 |
| created_at | 2026-01-08 01:33:09.655646+00 |
| updated_at | 2026-01-08 01:33:09.655646+00 |
| description | Creates a structure and instantiate it with values from a chosen toml file or chosen default values. |
| homepage | |
| repository | https://github.com/pino1536/rust-lib.config_from_toml |
| max_upload_size | |
| id | 2029383 |
| size | 5,574 |
Creates a structure and instantiate it with values from a chosen toml file or chosen default values.
The minimal but powerfull rust marcro to use a toml file as a config.
You can chose a config file path, a struct and default values that will be uses if the key is not found in the config.
let config = config_toml::Config!(
"config.toml", // File Name
{ // Struct and default values
value1: String = String::from("Hello Rust"),
value2: u32 = 7,
value3: bool = false,
}
);
println!("Value 1: {}", config.value1); // Use a config value :)
Example config.toml file:
value1 = "192.168.1.1"
value2 = 4
value3 = true
{Array} like values and [table] are not supportet at the moment.