mirror of
https://github.com/rust-lang/rust.git
synced 2024-11-22 23:04:33 +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| {
|
/// panic::set_hook(Box::new(|panic_info| {
|
||||||
/// if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
|
/// if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
|
||||||
/// println!("panic occurred: {s:?}");
|
/// println!("panic occurred: {s:?}");
|
||||||
|
/// } else if let Some(s) = panic_info.payload().downcast_ref::<String>() {
|
||||||
|
/// println!("panic occurred: {s:?}");
|
||||||
/// } else {
|
/// } else {
|
||||||
/// println!("panic occurred");
|
/// println!("panic occurred");
|
||||||
/// }
|
/// }
|
||||||
|
Loading…
Reference in New Issue
Block a user