Function generate_enum

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

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"));