Downcast panic payload to String too in example.

This commit is contained in:
Mara Bos 2024-05-16 11:49:55 +02:00
parent f5fe82fdca
commit ce0bc8bd58

View File

@ -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");
/// }