From 9826b2cda730116e148120dafe0fa89bd389626e Mon Sep 17 00:00:00 2001 From: Raphael Cohn Date: Fri, 1 Sep 2017 09:06:27 +0100 Subject: Added HJSON (Human-Readable JSON) as a config file format --- src/file/format/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/file/format/mod.rs') 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), } } } -- cgit v1.2.3