[][src]Function config_struct::generate_struct

pub fn generate_struct<P: AsRef<Path>>(
    filepath: P,
    options: &StructOptions
) -> 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

let code = config_struct::generate_struct("config.toml", &Default::default())?;
assert!(code.contains("pub struct Config"));