I have this error type:
#[derive(Debug)]
pub struct UserFacing {
pub msg: String,
pub source: Option<Box<dyn Error + Send + Sync>>,
}
I've just recently added the Send + Sync
bound because I want it to work inside a par_iter
of rayon
. Everything works out, basically, except: How do I implement Error
for this?
The problem is fn source(&self) -> Option<&(dyn Error + 'static)>
which does not have the Send + Sync
bounds on the output. I've tried downcasting to no avail (because the target is a dyn
rather than a concrete type), and google would not help out.
Any pointers welcome