pub fn init() {
    use std::sync::Once;
    static INIT: Once = Once::new();
    INIT.call_once(|| {
        let original_hook = std::panic::take_hook();
        std::panic::set_hook(Box::new(move |panic_info| {
            let mut swallow = false;
            if let Some(location) = panic_info.location() {
                if location.file() == file!() {
                    // if panic comes from this file, it must be due to StackOverflow
                    swallow = true;
                }
            }
            if !swallow {
                original_hook(&panic_info);
            }
        }));
    });
}
/// Initializes the global state, more precisely modifes panic hook such that:
/// - panics raised from StackLimit::panic_if_exceeded() are silenced;
/// - other panics are passed through the original panic hook.
Initializes the global state, more precisely modifes panic hook such that:
panics raised from StackLimit::panic_if_exceeded() are silenced;
other panics are passed through the original panic hook.
Initializes the global state more precisely modifes panic hook such that : panics raised from StackLimit :: panic_if_exceeded () are silenced ; other panics are passed through the original panic hook .
pub fn init() {
    use std::sync::Once;
    static INIT: Once = Once::new();
    INIT.call_once(|| {
        let original_hook = std::panic::take_hook();
        std::panic::set_hook(Box::new(move |panic_info| {
            let mut swallow = false;
            if let Some(location) = panic_info.location() {
                if location.file() == file!() {
                    // if panic comes from this file, it must be due to StackOverflow
                    swallow = true;
                }
            }
            if !swallow {
                original_hook(&panic_info);
            }
        }));
    });
}
pub fn init ( ) { use std :: sync :: Once ; static INIT : Once = Once :: new ( ) ; INIT . call_once ( | | { let original_hook = std :: panic :: take_hook ( ) ; std :: panic :: set_hook ( Box :: new ( move | panic_info | { let mut swallow = false ; if let Some ( location ) = panic_info . location ( ) { if location . file ( ) == file ! ( ) { // if panic comes from this file, it must be due to StackOverflow swallow = true ; } } if ! swallow { original_hook ( & panic_info ) ; } } ) ) ; } ) ; }
Initializes the global state, more precisely modifes panic hook such that:
 panics raised from StackLimit::panic_if_exceeded() are silenced;
 other panics are passed through the original panic hook.
Initializes the global state more precisely modifes panic hook such that : panics raised from StackLimit :: panic_if_exceeded () are silenced ; other panics are passed through the original panic hook .