macroconf

Crates.iomacroconf
lib.rsmacroconf
version0.3.6
sourcesrc
created_at2024-04-23 13:38:41.327012
updated_at2024-08-20 13:31:10.175985
descriptionmacro for creating configurations using miniconf
homepage
repositoryhttps://git.mkaenner.de/max/macroconf
max_upload_size
id1217602
size46,257
(MaxKaenner)

documentation

README

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
 */
Commit count: 0

cargo fmt