macro_rules! setup_panic {
    ($meta:expr) => { ... };
    () => { ... };
}
Expand description

human-panic initialisation macro

You can either call this macro with no arguments setup_panic!() or with a Metadata struct, if you don’t want the error message to display the values used in your Cargo.toml file.

The Metadata struct can’t implement Default because of orphan rules, which means you need to provide all fields for initialisation.

The macro should be called from within a function, for example as the first line of the main() function of the program.

use human_panic::setup_panic;

setup_panic!(Metadata {
    name: env!("CARGO_PKG_NAME").into(),
    version: env!("CARGO_PKG_VERSION").into(),
    authors: "My Company Support <support@mycompany.com>".into(),
    homepage: "support.mycompany.com".into(),
});