pub fn panic_payload_to_string(payload: &(dyn Any + Send)) -> Cow<'_, str>Expand description
Extract a message from a panic payload.
Handles &str, String, and &String payloads consistently. The borrowed
variants are returned as Cow::Borrowed, so the common panic!("literal")
case avoids the heap allocation that a String return would force.
Unrecognised payload types fall back to a Cow::Borrowed static string.
Call .into_owned() (or .to_string()) at sites that need an owned
String.