2. Adding it to the `Config` struct somewhere:
```rust
#[derive(Deserialize, Debug)]
pub struct Config {
/* . . . . */
pub my_custom_section: MyCustomSection
}
And that's it!
Using the Config
The config can be gotten anywhere after initialization with Config::config().
Paths are also accessible if they are declared appropriately in their sections:
let config = Config::config();
println!("Horns on a unicorn: {}", config.my_custom_section.unicornHorns);
Future plans
Config macros automatically generate JSON Schemas, and default JSONC sections.
Build script packages them together, to be bundled with a release.
Associated Issues: #46 #23
The main changes are the continuation of the custom Syntax from my first repo.
Adding a custom section
Now, implementing a configuration section is as simple as:
use crate::config::ConfigurationSection;
config_section!( MyCustomSection { "How many horns does a unicorn have?" unicornHorns => 1, } );
impl ConfigurationSection for MyCustomSection { const PATH : &'static str = "$.myCustomSection"; }
And that's it!
Using the Config
The config can be gotten anywhere after initialization with
Config::config()
. Paths are also accessible if they are declared appropriately in their sections:Future plans