summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRyan Leckey <leckey.ryan@gmail.com>2017-06-23 09:55:16 -0700
committerGitHub <noreply@github.com>2017-06-23 09:55:16 -0700
commit21cf8d83cb840e5e8d1f7eb76b9cd1cf984c7444 (patch)
treecadd5bdf6f9aaa4397b9310f0de1e84782c6abc9
parentf4fad94a58c2eef5e1e49b4f2b150eac0efbd360 (diff)
parent6c1d3807560dd2d177096118f8cce03933511685 (diff)
Merge pull request #37 from Jascha-N/boxed-error-send-sync
Make boxed errors Send + Sync
-rw-r--r--src/error.rs4
-rw-r--r--src/file/format/json.rs2
-rw-r--r--src/file/format/mod.rs2
-rw-r--r--src/file/format/toml.rs2
-rw-r--r--src/file/format/yaml.rs2
-rw-r--r--src/file/source/file.rs4
-rw-r--r--src/file/source/mod.rs2
-rw-r--r--src/file/source/string.rs2
8 files changed, 10 insertions, 10 deletions
diff --git a/src/error.rs b/src/error.rs
index 6b567a2..514a5e2 100644
--- a/src/error.rs
+++ b/src/error.rs
@@ -50,7 +50,7 @@ pub enum ConfigError {
/// The captured error from attempting to parse the file in its desired format.
/// This is the actual error object from the library used for the parsing.
- cause: Box<Error>
+ cause: Box<Error + Send + Sync>
},
/// Value could not be converted into the requested type.
@@ -75,7 +75,7 @@ pub enum ConfigError {
Message(String),
/// Unadorned error from a foreign origin.
- Foreign(Box<Error>),
+ Foreign(Box<Error + Send + Sync>),
}
impl ConfigError {
diff --git a/src/file/format/json.rs b/src/file/format/json.rs
index ed6c787..ead99f8 100644
--- a/src/file/format/json.rs
+++ b/src/file/format/json.rs
@@ -4,7 +4,7 @@ use std::collections::HashMap;
use std::error::Error;
use value::{Value, ValueKind};
-pub fn parse(uri: Option<&String>, text: &str) -> Result<HashMap<String, Value>, Box<Error>> {
+pub fn parse(uri: Option<&String>, text: &str) -> Result<HashMap<String, Value>, Box<Error + Send + Sync>> {
// Parse a JSON object value from the text
// TODO: Have a proper error fire if the root of a file is ever not a Table
let value = from_json_value(uri, &serde_json::from_str(text)?);
diff --git a/src/file/format/mod.rs b/src/file/format/mod.rs
index b3cf279..5aa1acb 100644
--- a/src/file/format/mod.rs
+++ b/src/file/format/mod.rs
@@ -66,7 +66,7 @@ impl FileFormat {
pub fn parse(&self,
uri: Option<&String>,
text: &str)
- -> Result<HashMap<String, Value>, Box<Error>> {
+ -> Result<HashMap<String, Value>, Box<Error + Send + Sync>> {
match *self {
#[cfg(feature = "toml")]
FileFormat::Toml => toml::parse(uri, text),
diff --git a/src/file/format/toml.rs b/src/file/format/toml.rs
index cecad75..4307e48 100644
--- a/src/file/format/toml.rs
+++ b/src/file/format/toml.rs
@@ -4,7 +4,7 @@ use std::collections::{HashMap, BTreeMap};
use std::error::Error;
use value::{Value, ValueKind};
-pub fn parse(uri: Option<&String>, text: &str) -> Result<HashMap<String, Value>, Box<Error>> {
+pub fn parse(uri: Option<&String>, text: &str) -> Result<HashMap<String, Value>, Box<Error + Send + Sync>> {
// Parse a TOML value from the provided text
// TODO: Have a proper error fire if the root of a file is ever not a Table
let value = from_toml_value(uri, &toml::from_str(text)?);
diff --git a/src/file/format/yaml.rs b/src/file/format/yaml.rs
index 4040ea6..3ed1356 100644
--- a/src/file/format/yaml.rs
+++ b/src/file/format/yaml.rs
@@ -6,7 +6,7 @@ use std::collections::{BTreeMap, HashMap};
use std::mem;
use value::{Value, ValueKind};
-pub fn parse(uri: Option<&String>, text: &str) -> Result<HashMap<String, Value>, Box<Error>> {
+pub fn parse(uri: Option<&String>, text: &str) -> Result<HashMap<String, Value>, Box<Error + Send + Sync>> {
// Parse a YAML object from file
let mut docs = yaml::YamlLoader::load_from_str(text)?;
let root = match docs.len() {
diff --git a/src/file/source/file.rs b/src/file/source/file.rs
index 790933f..7bf29be 100644
--- a/src/file/source/file.rs
+++ b/src/file/source/file.rs
@@ -26,7 +26,7 @@ impl FileSourceFile {
fn find_file(&self,
format_hint: Option<FileFormat>)
- -> Result<(PathBuf, FileFormat), Box<Error>> {
+ -> Result<(PathBuf, FileFormat), Box<Error + Send + Sync>> {
// First check for an _exact_ match
let mut filename = env::current_dir()?.as_path().join(self.name.clone());
if filename.is_file() {
@@ -83,7 +83,7 @@ impl FileSourceFile {
impl FileSource for FileSourceFile {
fn resolve(&self,
format_hint: Option<FileFormat>)
- -> Result<(Option<String>, String, FileFormat), Box<Error>> {
+ -> Result<(Option<String>, String, FileFormat), Box<Error + Send + Sync>> {
// Find file
let (filename, format) = self.find_file(format_hint)?;
diff --git a/src/file/source/mod.rs b/src/file/source/mod.rs
index 67e2cf1..f164d27 100644
--- a/src/file/source/mod.rs
+++ b/src/file/source/mod.rs
@@ -11,5 +11,5 @@ use super::FileFormat;
pub trait FileSource: Debug + Clone {
fn resolve(&self,
format_hint: Option<FileFormat>)
- -> Result<(Option<String>, String, FileFormat), Box<Error>>;
+ -> Result<(Option<String>, String, FileFormat), Box<Error + Send + Sync>>;
}
diff --git a/src/file/source/string.rs b/src/file/source/string.rs
index 70101d6..5dbd1b9 100644
--- a/src/file/source/string.rs
+++ b/src/file/source/string.rs
@@ -18,7 +18,7 @@ impl<'a> From<&'a str> for FileSourceString {
impl FileSource for FileSourceString {
fn resolve(&self,
format_hint: Option<FileFormat>)
- -> Result<(Option<String>, String, FileFormat), Box<Error>> {
+ -> Result<(Option<String>, String, FileFormat), Box<Error + Send + Sync>> {
Ok((None, self.0.clone(), format_hint.expect("from_str requires a set file format")))
}
}