diff options
author | Ryan Leckey <leckey.ryan@gmail.com> | 2017-02-12 10:02:07 -0800 |
---|---|---|
committer | Ryan Leckey <leckey.ryan@gmail.com> | 2017-02-12 10:02:07 -0800 |
commit | ccae9b09fa9d4650de3cf91013162a7277e46060 (patch) | |
tree | f2ff7c58a32f5418b48dd8327e6c45b74d20356c /src/file/mod.rs | |
parent | bcd0737e15726f3ad324c3cf26c5d04fe5f75766 (diff) |
Remove global API
Diffstat (limited to 'src/file/mod.rs')
-rw-r--r-- | src/file/mod.rs | 15 |
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)?; |