summaryrefslogtreecommitdiffstats
path: root/src/file
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
parentbcd0737e15726f3ad324c3cf26c5d04fe5f75766 (diff)
Remove global API
Diffstat (limited to 'src/file')
-rw-r--r--src/file/mod.rs15
-rw-r--r--src/file/yaml.rs4
2 files changed, 15 insertions, 4 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)?;
diff --git a/src/file/yaml.rs b/src/file/yaml.rs
index 00b749c..7a70a4e 100644
--- a/src/file/yaml.rs
+++ b/src/file/yaml.rs
@@ -20,7 +20,9 @@ impl Content {
let mut root = match docs.len() {
0 => yaml::Yaml::Hash(BTreeMap::new()),
1 => mem::replace(&mut docs[0], yaml::Yaml::Null),
- n => { return Err(Box::new(MultipleDocumentsError(n))); }
+ n => {
+ return Err(Box::new(MultipleDocumentsError(n)));
+ }
};
// Limit to namespace