Function config_struct::generate_config[][src]

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

Generate Rust source code defining structs based on a config file.

The format of the config file will be auto-detected from its extension.

Examples

This example is not tested
let code = config_struct::generate_config("config.toml", &Default::default())?;
assert!(code.contains("pub struct Config"));