summaryrefslogtreecommitdiffstats
path: root/src/format.rs
diff options
context:
space:
mode:
authorRadosław Kot <rdkt13@gmail.com>2021-07-31 12:57:55 +0200
committerRadosław Kot <rdkt13@gmail.com>2021-10-23 16:58:41 +0200
commit141ec79beaa217b7d2dd5fb66aaa2806fe035425 (patch)
treee00cf1d45023b824cac7f1c0cfd53cc62c4f80dc /src/format.rs
parenta78fc37b2eb0b25ce24c3ae8c54f6b33739cf6b6 (diff)
Implement Format for FileFormat
Diffstat (limited to 'src/format.rs')
-rw-r--r--src/format.rs35
1 files changed, 11 insertions, 24 deletions
diff --git a/src/format.rs b/src/format.rs
index d2fe494..9d666c4 100644
--- a/src/format.rs
+++ b/src/format.rs
@@ -1,24 +1,11 @@
-use std::{collections::HashMap, error::Error};
-
-use crate::value::Value;
-
-pub trait Format {
- fn parse(
- self,
- uri: Option<&String>,
- text: &str,
- ) -> Result<HashMap<String, Value>, Box<dyn Error + Send + Sync>>;
-}
-
-impl<F> Format for F
-where
- F: Fn(Option<&String>, &str) -> Result<HashMap<String, Value>, Box<dyn Error + Send + Sync>>
-{
- fn parse(
- self,
- uri: Option<&String>,
- text: &str,
- ) -> Result<HashMap<String, Value>, Box<dyn Error + Send + Sync>> {
- self(uri, text)
- }
-} \ No newline at end of file
+use std::{collections::HashMap, error::Error};
+
+use crate::value::Value;
+
+pub trait Format {
+ fn parse(
+ &self,
+ uri: Option<&String>,
+ text: &str,
+ ) -> Result<HashMap<String, Value>, Box<dyn Error + Send + Sync>>;
+}