10 releases
0.3.6 | Aug 20, 2024 |
---|---|
0.3.5 | Aug 20, 2024 |
0.2.1 | Aug 3, 2024 |
0.2.0 | Jul 25, 2024 |
0.1.0 | Apr 23, 2024 |
#419 in Configuration
37KB
783 lines
macroconf
This library provides a macro to create configs with metadata attached to the values. The miniconf library is used to make the metadata and the values accessible.
Example
use miniconf::Tree;
use macroconf::config;
#[config]
#[derive(Tree)]
struct Config {
ordinary: i32,
#[min = 10]
#[max = 20]
clamped: u8
#[default = 42]
has_default: i32;
/// Doc comments are used as description
with_description: i32
}
/* The resulting miniconf tree looks like this:
* /
* |-ordinary
* |
* |-clamped
* | |-value
* | |-min
* | |-max
* |
* |-has_default
* | |-value
* | |-default
* |
* |-with_description
* |-value
* |-description
*/
lib.rs
:
This crate creates miniconf::Tree
implementations fields in a struct. These carry some extra
extra information about the field.
Dependencies
~1–1.5MB
~29K SLoC