Crates.io | macroconf |
lib.rs | macroconf |
version | 0.3.6 |
source | src |
created_at | 2024-04-23 13:38:41.327012 |
updated_at | 2024-08-20 13:31:10.175985 |
description | macro for creating configurations using miniconf |
homepage | |
repository | https://git.mkaenner.de/max/macroconf |
max_upload_size | |
id | 1217602 |
size | 46,257 |
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.
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
*/