1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
#![doc = include_str!("../README.md")]
#![no_std]
// snowplay uses 100% Safe Rust.
#![forbid(unsafe_code)]
#![warn(
    // Warns you about missing documentation comments.
    missing_docs,
    clippy::missing_docs_in_private_items,
    clippy::missing_errors_doc,
    clippy::missing_panics_doc,

    // Warns you when you have dependencies you're not using.
    unused_crate_dependencies,
)]

/// A panic handler that prints out the panic message in-game.
///
/// You can use it in your own mod like this:
/// ```
/// // Don't use the panic handler during tests since tests will have access to std.
/// #[cfg(not(test))]
/// #[panic_handler]
/// fn panic_handler(panic_info: &core::panic::PanicInfo) -> ! {
///     snowplay::panic_handler(panic_info)
/// }
/// ```
#[cfg(target_family = "wasm")]
pub fn panic_handler(_panic_info: &core::panic::PanicInfo) -> ! {
    // Something something print a message in-game somehow...
    core::arch::wasm32::unreachable()
}