summaryrefslogtreecommitdiffstats
path: root/src/file/format/mod.rs
diff options
context:
space:
mode:
Diffstat (limited to 'src/file/format/mod.rs')
-rw-r--r--src/file/format/mod.rs13
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),
}
}
}