Crate config_more_formats

Source
Expand description

Add more formats to config.

This crate provides additional formats for figment. If you need additional formats, you can include this crate and use the provided formats.

Additionally, this adds a function to parse a file by its extension.

Supported formats added by this crate:

FormatFeatureCrateDescription
YAML-NGyaml_ngserde-yaml-ngAn actively maintained fork of serde_yaml
JAVA Propertiespropertiesserde-java-propertiesJava properties file format
HJSONhjsonserde-hjsonHuman JSON
HCLhclhcl-rsHashiCorp Configuration Language
AsonasonasonAson format
JSONjsonserde_jsonconfig supplied JSON format
JSON5json5serde-json5config supplied JSON5 format
RONronronconfig supplied RON format
TOMLtomltomlconfig supplied TOML format
YAMLyamlyaml-rustconfig supplied YAML format (using deprecated serde_yaml)
INIiniiniconfig supplied INI format
allEnable all formats except for yaml

If you do not enable yaml, yaml_ng will be used for yaml files instead. Instead of all, enable only the formats you need to reduce compile times and dependencies.

The current development version of config already uses yaml-rust2 which is a fork of yaml-rust and is actively maintained. This crate uses serde_yaml_ng which is another actively maintained solution for YAML.

§Example of by_file_extension

use config::Config;use config_more_formats::by_file_extension;


    let settings = Config::builder()
        .add_source(by_file_extension("settings.toml").unwrap())
        .build()
        .unwrap();

Structs§

Ason
Hcl
Hjson
Properties
YamlNg

Enums§

FormatError
Error type for format parsing.
FormatWrapper

Functions§

by_file_extension
Parse a file by its extension.