diff options
author | Raphael Cohn <raphael.cohn@stormmq.com> | 2017-09-01 09:06:27 +0100 |
---|---|---|
committer | Raphael Cohn <raphael.cohn@stormmq.com> | 2017-09-01 09:06:27 +0100 |
commit | 9826b2cda730116e148120dafe0fa89bd389626e (patch) | |
tree | 164597d8e40017ca690c259c75eacee9134f6f5d /src/file/format/mod.rs | |
parent | 13151213a7b368296c616e0a770fb2c238fff1a0 (diff) |
Added HJSON (Human-Readable JSON) as a config file format
Diffstat (limited to 'src/file/format/mod.rs')
-rw-r--r-- | src/file/format/mod.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/file/format/mod.rs b/src/file/format/mod.rs index a90dfda..5dfdfde 100644 --- a/src/file/format/mod.rs +++ b/src/file/format/mod.rs @@ -16,6 +16,9 @@ mod json; #[cfg(feature = "yaml")] mod yaml; +#[cfg(feature = "hjson")] +mod hjson; + #[derive(Debug, Clone, Copy, Eq, PartialEq, Hash)] pub enum FileFormat { /// TOML (parsed with toml) @@ -29,6 +32,10 @@ pub enum FileFormat { /// YAML (parsed with yaml_rust) #[cfg(feature = "yaml")] Yaml, + + /// HJSON (parsed with serde_hjson) + #[cfg(feature = "hjson")] + Hjson, } lazy_static! { @@ -46,6 +53,9 @@ lazy_static! { #[cfg(feature = "yaml")] formats.insert(FileFormat::Yaml, vec!["yaml", "yml"]); + #[cfg(feature = "hjson")] + formats.insert(FileFormat::Hjson, vec!["hjson"]); + formats }; } @@ -77,6 +87,9 @@ impl FileFormat { #[cfg(feature = "yaml")] FileFormat::Yaml => yaml::parse(uri, text), + + #[cfg(feature = "hjson")] + FileFormat::Hjson => hjson::parse(uri, text), } } } |