[][src]Function config_struct::create_struct_from_source

pub fn create_struct_from_source<S: AsRef<str>, P: AsRef<Path>>(
    source: S,
    destination: P,
    options: &StructOptions
) -> Result<(), Error>

Generate a Rust module containing struct definitions from a config string in a format specified by the provided options.

Examples

use config_struct::{Format, StructOptions};

config_struct::create_struct_from_source(
    "number = 100  # This is valid TOML.",
    "src/config.rs",
    &StructOptions {
        format: Some(Format::Toml),
        ..Default::default()
    })?;