/// Attempts to extract the payload contents from the panic (e.g. panic!("this is the payload"))
Attempts to extract the payload contents from the panic )
Attempts to extract the payload contents from the panic )
fn try_extract_payload(panic_info: &PanicInfo) -> Option<String> {
    // This currently only handles standard panic payloads (&str and String). If we ever use
    // panic_any, we'll have to explicitly handle it here.
    if let Some(s) = panic_info.payload().downcast_ref::<&str>() {
        Some(s.to_string())
    } else {
        panic_info.payload().downcast_ref::<String>().cloned()
    }
}
fn try_extract_payload ( panic_info : & PanicInfo ) -> Option < String > { // This currently only handles standard panic payloads (&str and String). If we ever use // panic_any, we'll have to explicitly handle it here. if let Some ( s ) = panic_info . payload ( ) . downcast_ref :: < & str > ( ) { Some ( s . to_string ( ) ) } else { panic_info . payload ( ) . downcast_ref :: < String > ( ) . cloned ( ) } }
Attempts to extract the payload contents from the panic (e.g.
Attempts to extract the payload contents from the panic ( e . g .
panic_info
&PanicInfo