ConfMap

Derive Macro ConfMap 

Source
#[derive(ConfMap)]
{
    // Attributes available to this derive:
    #[conf_map]
}
Expand description

Derives the FromConf and ToConf traits for struct types

This attribute allows a struct to be serialized to and deserialized from configuration format using the confetti-rs library.

§Example

use confetti_rs::ConfMap;

#[derive(ConfMap, Debug)]
struct ServerConfig {
    port: i32,
    host: String,
    #[conf_map(name = "max-connections")]
    max_connections: Option<i32>,
}

§Attributes

  • #[conf_map(name = "field-name")]: Specify a custom name for the field in the configuration