[][src]Function config_struct::generate_enum

pub fn generate_enum<P: AsRef<Path>>(
    filepath: P,
    options: &EnumOptions
) -> Result<String, Error>

Generate Rust source code defining an enum based on a map-like config file.

The enum variants are based on the keys of the map. The format of the config file will be auto-detected from its extension.

Examples

let code = config_struct::generate_enum("map.toml", &Default::default())?;
assert!(code.contains("pub struct Key"));