Reputation: 1128
Rust docs show a std::io::Error
being created using
let custom_error = Error::new(ErrorKind::Other, "oh no!");
and new
has a type signature of
fn new<E>(kind: ErrorKind, error: E) -> Error
where E: Into<Box<std::error::Error + Send + Sync>>
I've found an implementation of impl<T: std::error::Error> std::error::Error for Box<T>
but cannot find one for &'static str
like the one used in the example.
What trait is used to achieve Into<Error>
for strings?
Upvotes: 3
Views: 570