Go to file
2024-08-19 22:26:43 +02:00
src implement enum variant generation 2024-08-19 22:26:43 +02:00
tests don't generate default with getter 2024-08-18 18:28:29 +02:00
.gitignore Initial commit 2024-04-15 20:49:37 +02:00
Cargo.toml chore: Release macroconf version 0.3.4 2024-08-18 19:51:24 +02:00
LICENSE Initial commit 2024-04-15 20:49:37 +02:00
README.md add README description 2024-04-15 21:05:19 +02:00

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
 */