From f82ca02c15b675ba889143aa7f7cd3c69e3f1810 Mon Sep 17 00:00:00 2001 From: Thayne McCombs Date: Fri, 3 Feb 2017 22:02:48 -0700 Subject: Add support for YAML --- src/file/mod.rs | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'src/file/mod.rs') 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), } } } -- cgit v1.2.3