/// Tries to get a meaningful description from the given panic.
Tries to get a meaningful description from the given panic.
Tries to get a meaningful description from the given panic .
pub(crate) fn description_from_panic(any: impl AsRef<(dyn Any + Send)>) -> String {
        let any = any.as_ref();
        if let Some(s) = any.downcast_ref::<&str>() {
            (*s).to_string()
        } else if let Some(s) = any.downcast_ref::<String>() {
            s.clone()
        } else if let Some(error) = any.downcast_ref::<Box<(dyn std::error::Error + Send)>>() {
            error.description().to_string()
        } else if let Some(error) = any.downcast_ref::<failure::Error>() {
            error.to_string()
        } else {
            // Unknown error kind; keep its description empty.
            String::new()
        }
    }
pub ( crate ) fn description_from_panic ( any : impl AsRef < ( dyn Any + Send ) > ) -> String { let any = any . as_ref ( ) ; if let Some ( s ) = any . downcast_ref :: < & str > ( ) { ( * s ) . to_string ( ) } else if let Some ( s ) = any . downcast_ref :: < String > ( ) { s . clone ( ) } else if let Some ( error ) = any . downcast_ref :: < Box < ( dyn std :: error :: Error + Send ) > > ( ) { error . description ( ) . to_string ( ) } else if let Some ( error ) = any . downcast_ref :: < failure :: Error > ( ) { error . to_string ( ) } else { // Unknown error kind; keep its description empty. String :: new ( ) } }
Tries to get a meaningful description from the given panic.
Tries to get a meaningful description from the given panic .
any
impl AsRef<(dyn Any + Send)>