Function config_struct::generate_config_with_format[][src]

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

Generate Rust source code defining structs based on a config file of an explicit format.

Examples

This example is not tested
use config_struct::Format;

let code = config_struct::generate_config_with_format(
    Format::Toml,
    "config.toml",
    &Default::default())?;

assert!(code.contains("pub struct Config"));