Repository: rust-cli/human-panic (language: rust)

Issue:
Missing doc on exact usage of this crate
**Choose one:** is this a 🐛 bug report

Missing docs are a bug, right? :laughing: 

So what I am missing is just a short explanation where to call the `setup_panic!()` macro, actually: Inside `main`? Outside of any function?
Just a bit of confusion on my end because the docs do not show where to put the call.

Thanks for this nice crate!


Discussion / hints:
In general, it depends on how early you're willing to print a human-readable panic. If you set it later into your program's logic, then you could possibly have a panic which doesn't use this library's panic hook - meaning the message will just be "panicking because of thing hahah!" 

For that reason, most people will want to put it in their program's entrypoint. For almost all Rust binaries, that'll be somewhere at the top of `main()`, or even as the first line of main. Again, the earlier you set the hook, the more clear-cut (and reportable) panics will be to your users.

I hope that helps! If you have any other questions, please let me know! :)

Fix patch:
diff --git a/src/lib.rs b/src/lib.rs
index a2aea4c..f529a1b 100644
--- a/src/lib.rs
+++ b/src/lib.rs
@@ -88,6 +88,9 @@ macro_rules! metadata {
 /// 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;
 ///


Test patch: