error: add Send + Sync trait bounds on StringParse error container

This commit is contained in:
Matt Bilker 2019-11-08 05:22:11 +00:00
parent a840cc63fa
commit 60a05c00b8
No known key found for this signature in database
GPG Key ID: 69ADF8AEB6C8B5D1
2 changed files with 5 additions and 3 deletions

View File

@ -76,7 +76,7 @@ pub enum KbinError {
#[snafu(display("Unable to interpret input as {}", node_type))]
StringParse {
node_type: &'static str,
source: Box<dyn Error>,
source: Box<dyn Error + Send + Sync>,
},
#[snafu(display("Unable to interpret integer input as {}", node_type))]

View File

@ -21,7 +21,7 @@ fn space_check(input: &str) -> Result<()> {
fn parse_tuple<T>(node_type: &'static str, input: &str, output: &mut [T]) -> Result<()>
where T: FromStr,
T::Err: Error + 'static,
T::Err: Error + Send + Sync + 'static,
{
let count = input.split(' ').count();
if count != output.len() {
@ -29,7 +29,9 @@ fn parse_tuple<T>(node_type: &'static str, input: &str, output: &mut [T]) -> Res
}
for (i, part) in input.split(' ').enumerate() {
output[i] = part.parse::<T>().map_err(|e| Box::new(e) as Box<dyn Error>).context(StringParse { node_type })?;
output[i] = part.parse::<T>()
.map_err(|e| Box::new(e) as Box<(dyn Error + Send + Sync + 'static)>)
.context(StringParse { node_type })?;
}
Ok(())