Struct config_struct::Options[][src]

pub struct Options {
    pub struct_name: String,
    pub const_name: Option<String>,
    pub generate_const: bool,
    pub derived_traits: Vec<String>,
    pub generate_load_fns: bool,
    pub dynamic_loading: DynamicLoading,
    pub create_dirs: bool,
    pub default_float_size: FloatSize,
    pub default_int_size: IntSize,
    pub max_array_size: usize,
}

Options for configuring the generation of a config struct.

Fields

The name of the resulting struct. Defaults to "Config".

The name of the resulting const, if generated. Defaults to the value of struct_name in uppercase.

Whether or not to generate a const instance of the struct. Defaults to true.

A list of traits for the struct to derive. Defaults to ["Debug", "Clone", "Serialize", "Deserialize"]

Note: if you include Serialize/Deserialize, you must also include the serde and serde_derive crates in the crate that uses the generated config module.

Whether or not to generate helper functions to load the struct at runtime. Defaults to true.

Note: if you enable the generation of dynamic loading functions, you must also include the relevant deserialization crate in the crate that uses the generated config module.

For example, if you generate a config based on "config.json", you must also include extern crate serde_json in your crate. Likewise with toml, ron, and serde_yaml for the other supported formats.

Whether the load functions, if generated, are dynamic, and when. Defaults to DebugOnly.

Whether or not to create the parent directories of the output file, if they don't exist. Defaults to true.

The type of floating point values in the config, where the format does not make it explicit.

Defaults to F64.

The type of integer values in the config, where the format does not make it explicit.

Defaults to I64.

The maximum array size, over which array values in the config will be represented as slices instead. If set to 0, slices will always be used.

Defaults to 0.

Methods

impl Options
[src]

Trait Implementations

impl Debug for Options
[src]

Formats the value using the given formatter. Read more

impl Clone for Options
[src]

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

impl PartialEq for Options
[src]

This method tests for self and other values to be equal, and is used by ==. Read more

This method tests for !=.

impl Eq for Options
[src]

impl Default for Options
[src]

use config_struct::*;

Options {
    struct_name: "Config".to_owned(),
    const_name: None,
    generate_const: true,
    derived_traits: vec![
        "Debug".to_owned(),
        "Clone".to_owned(),
        "Serialize".to_owned(),
        "Deserialize".to_owned(),
    ],
    generate_load_fns: true,
    dynamic_loading: DynamicLoading::DebugOnly,
    create_dirs: true,
    default_float_size: FloatSize::F64,
    default_int_size: IntSize::I64,
    max_array_size: 0,
};

Auto Trait Implementations

impl Send for Options

impl Sync for Options