diff options
author | Ryan Leckey <leckey.ryan@gmail.com> | 2017-02-07 17:15:23 -0800 |
---|---|---|
committer | GitHub <noreply@github.com> | 2017-02-07 17:15:23 -0800 |
commit | 788a08756ab88b48c117257685ad7b93b8fab641 (patch) | |
tree | bf7eac8cabb2244bff0fa18f2c3c78c5c3daba35 /src/file/mod.rs | |
parent | 09b030a2b2b536d2af1c70bda560f6c0d6a36d41 (diff) | |
parent | f82ca02c15b675ba889143aa7f7cd3c69e3f1810 (diff) |
Merge pull request #6 from tmccombs/yaml
Add support for YAML
Diffstat (limited to 'src/file/mod.rs')
-rw-r--r-- | src/file/mod.rs | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/src/file/mod.rs b/src/file/mod.rs index 7e9d1a2..8f9578d 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), } } } |