From e29748b255ce97dfe9b4efcfbc4d9bcb3d694b97 Mon Sep 17 00:00:00 2001 From: Ryan Leckey Date: Sun, 12 Feb 2017 11:04:30 -0800 Subject: Decorate Box with Send + Sync --- src/config.rs | 6 +++--- src/env.rs | 2 +- src/file/json.rs | 2 +- src/file/mod.rs | 12 ++++++------ src/file/toml.rs | 2 +- src/file/yaml.rs | 2 +- src/source.rs | 2 +- 7 files changed, 14 insertions(+), 14 deletions(-) diff --git a/src/config.rs b/src/config.rs index 403f566..ad4cda2 100644 --- a/src/config.rs +++ b/src/config.rs @@ -29,7 +29,7 @@ enum ConfigStore { overrides: HashMap, // Ordered list of sources - sources: Vec>, + sources: Vec>, }, // TODO: Will be used for frozen configuratino soon @@ -213,7 +213,7 @@ fn path_set_str(root: &mut HashMap, key: &str, value: &Value) { impl ConfigStore { fn merge(&mut self, source: T) -> Result<(), Box> - where T: SourceBuilder + where T: SourceBuilder + Send + Sync { if let ConfigStore::Mutable { ref mut sources, .. } = *self { sources.push(source.build()?); @@ -285,7 +285,7 @@ impl Config { /// Merge in configuration values from the given source. pub fn merge(&mut self, source: T) -> Result<(), Box> - where T: SourceBuilder + where T: SourceBuilder + Send + Sync { self.store.merge(source)?; self.refresh()?; diff --git a/src/env.rs b/src/env.rs index dd237db..5c80bad 100644 --- a/src/env.rs +++ b/src/env.rs @@ -21,7 +21,7 @@ impl Environment { } impl source::SourceBuilder for Environment { - fn build(&self) -> Result, Box> { + fn build(&self) -> Result, Box> { Ok(Box::new(self.clone())) } } diff --git a/src/file/json.rs b/src/file/json.rs index 64c6236..e6cc2f4 100644 --- a/src/file/json.rs +++ b/src/file/json.rs @@ -11,7 +11,7 @@ pub struct Content { } impl Content { - pub fn parse(text: &str, namespace: Option<&String>) -> Result, Box> { + pub fn parse(text: &str, namespace: Option<&String>) -> Result, Box> { // Parse let mut root: serde_json::Value = serde_json::from_str(text)?; 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> { + fn parse(&self, text: &str, namespace: Option<&String>) -> Result, Box> { 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>; + -> Result, Box>; } pub struct FileSourceString(String); @@ -74,7 +74,7 @@ impl FileSource for FileSourceString { fn try_build(&self, format: FileFormat, namespace: Option<&String>) - -> Result, Box> { + -> Result, Box> { format.parse(&self.0, namespace) } } @@ -132,7 +132,7 @@ impl FileSource for FileSourceFile { fn try_build(&self, format: FileFormat, namespace: Option<&String>) - -> Result, Box> { + -> Result, Box> { // Find file let filename = self.find_file(format)?; @@ -195,7 +195,7 @@ impl File { } // Build normally and return error on failure - fn try_build(&self) -> Result, Box> { + fn try_build(&self) -> Result, Box> { self.source.try_build(self.format, self.namespace.as_ref()) } } @@ -209,7 +209,7 @@ impl File { impl SourceBuilder for File { // Use try_build but only pass an error through if this source // is required - fn build(&self) -> Result, Box> { + fn build(&self) -> Result, Box> { if self.required { self.try_build() } else { diff --git a/src/file/toml.rs b/src/file/toml.rs index e3fb0d8..9b07cf0 100644 --- a/src/file/toml.rs +++ b/src/file/toml.rs @@ -10,7 +10,7 @@ pub struct Content { } impl Content { - pub fn parse(text: &str, namespace: Option<&String>) -> Result, Box> { + pub fn parse(text: &str, namespace: Option<&String>) -> Result, Box> { // Parse let mut parser = toml::Parser::new(text); // TODO: Get a solution to make this return an Error-able diff --git a/src/file/yaml.rs b/src/file/yaml.rs index 7a70a4e..95a64b4 100644 --- a/src/file/yaml.rs +++ b/src/file/yaml.rs @@ -13,7 +13,7 @@ pub struct Content { } impl Content { - pub fn parse(text: &str, namespace: Option<&String>) -> Result, Box> { + pub fn parse(text: &str, namespace: Option<&String>) -> Result, Box> { let mut docs = yaml::YamlLoader::load_from_str(text)?; // Designate root diff --git a/src/source.rs b/src/source.rs index e136176..2048791 100644 --- a/src/source.rs +++ b/src/source.rs @@ -8,5 +8,5 @@ pub trait Source { } pub trait SourceBuilder { - fn build(&self) -> Result, Box>; + fn build(&self) -> Result, Box>; } -- cgit v1.2.3