mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 14:55:26 +00:00
Downcast panic payload to String too in example.
This commit is contained in:
parent
f5fe82fdca
commit
ce0bc8bd58
@ -73,6 +73,8 @@ impl<'a> PanicHookInfo<'a> {
|
||||
/// panic::set_hook(Box::new(|panic_info| {
|
||||
/// if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
|
||||
/// println!("panic occurred: {s:?}");
|
||||
/// } else if let Some(s) = panic_info.payload().downcast_ref::<String>() {
|
||||
/// println!("panic occurred: {s:?}");
|
||||
/// } else {
|
||||
/// println!("panic occurred");
|
||||
/// }
|
||||
|
Loading…
Reference in New Issue
Block a user