diff options
author | Radosław Kot <rdkt13@gmail.com> | 2021-07-31 12:57:55 +0200 |
---|---|---|
committer | Radosław Kot <rdkt13@gmail.com> | 2021-10-23 16:58:41 +0200 |
commit | 141ec79beaa217b7d2dd5fb66aaa2806fe035425 (patch) | |
tree | e00cf1d45023b824cac7f1c0cfd53cc62c4f80dc /src/file | |
parent | a78fc37b2eb0b25ce24c3ae8c54f6b33739cf6b6 (diff) |
Implement Format for FileFormat
Diffstat (limited to 'src/file')
-rw-r--r-- | src/file/format/mod.rs | 20 |
1 files changed, 18 insertions, 2 deletions
diff --git a/src/file/format/mod.rs b/src/file/format/mod.rs index b4129e1..47b856d 100644 --- a/src/file/format/mod.rs +++ b/src/file/format/mod.rs @@ -6,7 +6,7 @@ use std::collections::HashMap; use std::error::Error; use crate::map::Map; -use crate::value::Value; +use crate::{value::Value, Format}; #[cfg(feature = "toml")] mod toml; @@ -95,7 +95,7 @@ impl FileFormat { #[doc(hidden)] #[allow(unused_variables)] pub fn parse( - self, + &self, uri: Option<&String>, text: &str, ) -> Result<Map<String, Value>, Box<dyn Error + Send + Sync>> { @@ -120,3 +120,19 @@ impl FileFormat { } } } + +impl Format for FileFormat { + fn parse( + &self, + uri: Option<&String>, + text: &str, + ) -> Result<HashMap<String, Value>, Box<dyn Error + Send + Sync>> { + self.parse(uri, text) + } +} + +impl FileExtensions for FileFormat { + fn extensions(&self) -> &Vec<&'static str> { + self.extensions() + } +} |