We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
I'm too lazy to fork and PR right now, sorry ^^
I just think that
let msg = info.payload().downcast_ref::<&'static str>() .or_else(|| { info.payload() .downcast_ref::<String>() .map(String::as_str) }) .unwrap_or("Box<Any>");
would be a bit more idiomatic than the current nested match blocks. I haven't tested the code, but I hope you get the idea
The text was updated successfully, but these errors were encountered:
Apparently there is another rather elegant way of going about this:
https://docs.rs/human-panic/1.0.3/src/human_panic/lib.rs.html#194-201
let message = match ( panic_info.payload().downcast_ref::<&str>(), panic_info.payload().downcast_ref::<String>(), ) { (Some(s), _) => Some(s.to_string()), (_, Some(s)) => Some(s.to_string()), (None, None) => None, };
Sorry, something went wrong.
No branches or pull requests
I'm too lazy to fork and PR right now, sorry ^^
I just think that
would be a bit more idiomatic than the current nested match blocks. I haven't tested the code, but I hope you get the idea
The text was updated successfully, but these errors were encountered: