generate_struct

Function generate_struct 

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

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