summaryrefslogtreecommitdiffstats
path: root/src/file/mod.rs
diff options
context:
space:
mode:
authorRyan Leckey <leckey.ryan@gmail.com>2017-02-12 10:02:07 -0800
committerRyan Leckey <leckey.ryan@gmail.com>2017-02-12 10:02:07 -0800
commitccae9b09fa9d4650de3cf91013162a7277e46060 (patch)
treef2ff7c58a32f5418b48dd8327e6c45b74d20356c /src/file/mod.rs
parentbcd0737e15726f3ad324c3cf26c5d04fe5f75766 (diff)
Remove global API
Diffstat (limited to 'src/file/mod.rs')
-rw-r--r--src/file/mod.rs15
1 files changed, 12 insertions, 3 deletions
diff --git a/src/file/mod.rs b/src/file/mod.rs
index 519a4bf..6c72c37 100644
--- a/src/file/mod.rs
+++ b/src/file/mod.rs
@@ -62,13 +62,19 @@ impl FileFormat {
}
pub trait FileSource {
- fn try_build(&self, format: FileFormat, namespace: Option<&String>) -> Result<Box<Source>, Box<Error>>;
+ fn try_build(&self,
+ format: FileFormat,
+ namespace: Option<&String>)
+ -> Result<Box<Source>, Box<Error>>;
}
pub struct FileSourceString(String);
impl FileSource for FileSourceString {
- fn try_build(&self, format: FileFormat, namespace: Option<&String>) -> Result<Box<Source>, Box<Error>> {
+ fn try_build(&self,
+ format: FileFormat,
+ namespace: Option<&String>)
+ -> Result<Box<Source>, Box<Error>> {
format.parse(&self.0, namespace)
}
}
@@ -123,7 +129,10 @@ impl FileSourceFile {
}
impl FileSource for FileSourceFile {
- fn try_build(&self, format: FileFormat, namespace: Option<&String>) -> Result<Box<Source>, Box<Error>> {
+ fn try_build(&self,
+ format: FileFormat,
+ namespace: Option<&String>)
+ -> Result<Box<Source>, Box<Error>> {
// Find file
let filename = self.find_file(format)?;