[][src]Function config_struct::create_enum

pub fn create_enum<SrcPath: AsRef<Path>, DstPath: AsRef<Path>>(
    filepath: SrcPath,
    destination: DstPath,
    options: &EnumOptions
) -> Result<(), Error>

Generate a Rust module containing an enum definition based on a given config file containing a map-like structure. The variants of the enum are based on the keys of the map.

The format of the config is auto-detected from its filename extension.

Examples

use config_struct::EnumOptions;

config_struct::create_enum("map.toml", "src/keys.rs", &EnumOptions::default())?;