diff options
author | Ryan Leckey <leckey.ryan@gmail.com> | 2017-02-12 11:04:30 -0800 |
---|---|---|
committer | Ryan Leckey <leckey.ryan@gmail.com> | 2017-02-12 11:04:30 -0800 |
commit | e29748b255ce97dfe9b4efcfbc4d9bcb3d694b97 (patch) | |
tree | 1b544db4cee3b392463edda743c3513c73f73459 /src/file/mod.rs | |
parent | e0fe3e151c24ab81f8d232b3e18841acacc3656e (diff) |
Decorate Box<Source> with Send + Sync
Diffstat (limited to 'src/file/mod.rs')
-rw-r--r-- | src/file/mod.rs | 12 |
1 files changed, 6 insertions, 6 deletions
diff --git a/src/file/mod.rs b/src/file/mod.rs index 6c72c37..7f7c0fb 100644 --- a/src/file/mod.rs +++ b/src/file/mod.rs @@ -47,7 +47,7 @@ impl FileFormat { } #[allow(unused_variables)] - fn parse(&self, text: &str, namespace: Option<&String>) -> Result<Box<Source>, Box<Error>> { + fn parse(&self, text: &str, namespace: Option<&String>) -> Result<Box<Source + Send + Sync>, Box<Error>> { match *self { #[cfg(feature = "toml")] FileFormat::Toml => toml::Content::parse(text, namespace), @@ -65,7 +65,7 @@ pub trait FileSource { fn try_build(&self, format: FileFormat, namespace: Option<&String>) - -> Result<Box<Source>, Box<Error>>; + -> Result<Box<Source + Send + Sync>, Box<Error>>; } pub struct FileSourceString(String); @@ -74,7 +74,7 @@ impl FileSource for FileSourceString { fn try_build(&self, format: FileFormat, namespace: Option<&String>) - -> Result<Box<Source>, Box<Error>> { + -> Result<Box<Source + Send + Sync>, Box<Error>> { format.parse(&self.0, namespace) } } @@ -132,7 +132,7 @@ impl FileSource for FileSourceFile { fn try_build(&self, format: FileFormat, namespace: Option<&String>) - -> Result<Box<Source>, Box<Error>> { + -> Result<Box<Source + Send + Sync>, Box<Error>> { // Find file let filename = self.find_file(format)?; @@ -195,7 +195,7 @@ impl<T: FileSource> File<T> { } // Build normally and return error on failure - fn try_build(&self) -> Result<Box<Source>, Box<Error>> { + fn try_build(&self) -> Result<Box<Source + Send + Sync>, Box<Error>> { self.source.try_build(self.format, self.namespace.as_ref()) } } @@ -209,7 +209,7 @@ impl File<FileSourceFile> { impl<T: FileSource> SourceBuilder for File<T> { // Use try_build but only pass an error through if this source // is required - fn build(&self) -> Result<Box<Source>, Box<Error>> { + fn build(&self) -> Result<Box<Source + Send + Sync>, Box<Error>> { if self.required { self.try_build() } else { |