Hi I am trying to refactor some code I wrote quite a while ago but having the following issue.
help: within std::result::Result<(std::boxed::Box<dyn config::Point>, std::time::SystemTime, f64, u64), error::YosemiteError>, the trait std::marker::Send is not implemented for std::rc::Rc<std::io::Error>
Not sure how it worked before but the error seems to make sense Rcstd::io::Error is not Send so I want to proceed with correcting this.
std::io::Error is not clone which is why I had the Rc I believe. How should I define an Error that can be returned from threads keeping the original io error ?
Not sure what is the best practice. Should I just convert the io error to String or something ?
In similar situations, I've defined a custom structure to handle the type erasure instead of relying solely on Rust's dyn machinery. For errors, it might look something like this:
As far as the compiler is concerned, std might one day implement the Error trait for str. If that happens, there would be no way for the compiler to choose between them. In practice, you can rarely mix generic From implementations with ones for specific types. Instead, one or the other needs to be written as either an inherent method or a different trait.