summaryrefslogtreecommitdiffstats
path: root/src/file/mod.rs
diff options
context:
space:
mode:
authorThayne McCombs <astrothayne@gmail.com>2017-02-03 22:02:48 -0700
committerThayne McCombs <astrothayne@gmail.com>2017-02-03 22:02:48 -0700
commitf82ca02c15b675ba889143aa7f7cd3c69e3f1810 (patch)
treef5448f1473899936eb6ed62b4e7fa34c34d62a69 /src/file/mod.rs
parent115fe07e2c11aa72e91a5ce9b028ed1c1ff7d806 (diff)
Add support for YAML
Diffstat (limited to 'src/file/mod.rs')
-rw-r--r--src/file/mod.rs13
1 files changed, 13 insertions, 0 deletions
diff --git a/src/file/mod.rs b/src/file/mod.rs
index e85d082..5207508 100644
--- a/src/file/mod.rs
+++ b/src/file/mod.rs
@@ -14,6 +14,9 @@ mod toml;
#[cfg(feature = "json")]
mod json;
+#[cfg(feature = "yaml")]
+mod yaml;
+
#[derive(Clone, Copy)]
pub enum FileFormat {
/// TOML (parsed with toml)
@@ -23,6 +26,10 @@ pub enum FileFormat {
/// JSON (parsed with serde_json)
#[cfg(feature = "json")]
Json,
+
+ /// YAML (parsed with yaml_rust)
+ #[cfg(feature = "yaml")]
+ Yaml,
}
impl FileFormat {
@@ -33,6 +40,9 @@ impl FileFormat {
#[cfg(feature = "json")]
FileFormat::Json => vec!["json"],
+
+ #[cfg(feature = "yaml")]
+ FileFormat::Yaml => vec!["yaml", "yml"],
}
}
@@ -44,6 +54,9 @@ impl FileFormat {
#[cfg(feature = "json")]
FileFormat::Json => json::Content::parse(text),
+
+ #[cfg(feature = "yaml")]
+ FileFormat::Yaml => yaml::Content::parse(text),
}
}
}