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.