#panic #panic-hook #visualpanic

nightly visualpanic-rs

A library providing a panic hook for Rust applications that visualizes the panic with a native error dialog on supported systems

3 releases

0.1.2 Nov 21, 2023
0.1.1 Nov 21, 2023
0.1.0 Nov 21, 2023

#664 in Debugging

Download history 30/week @ 2024-02-25 5/week @ 2024-03-10 48/week @ 2024-03-31 3/week @ 2024-04-07 8/week @ 2024-04-14 94/week @ 2024-04-21

102 downloads per month

MIT license

9KB
79 lines

VisualPanic (visualpanic-rs)

Crates.io License

A library providing a panic hook for Rust applications that visualizes the panic with a native error dialog on supported systems (see listed OSes at native-dialog).

Installation

cargo add visualpanic_rs

Example 1: Use the default settings and register for the whole application

use visualpanic_rs::VisualPanic;
fn main() {
     VisualPanic::default().register_global();
}

Example 2: Use custom settings and register for the whole application

use visualpanic_rs::VisualPanic;
use visualpanic_rs::VisualPanicLevel;
fn main() {
     VisualPanic::new(
         Some("path/to/custom_icon.png"),
         Some("Custom Title"),
         Some(VisualPanicLevel::Info))
     .register_global();
}

lib.rs:

VisualPanic

Visualize panics with native GUI dialogs on supported systems (see list at https://crates.io/crates/native-dialog).

Provides a solution to panic visually, useful for GUI applications where a console view might not be available at all times. Customizable in some ways, e.g., which icon, title and dialog level should be used.

Example 1: Use the default settings and register for the whole application

fn main() {
    VisualPanic::default().register_global();
}

Example 2: Use custom settings and register for the whole application

fn main() {
    VisualPanic::new(
        Some("path/to/custom_icon.png"),
        Some("Custom Title"),
        Some(VisualPanicLevel::Info))
    .register_global();
}

Dependencies

~0.6–10MB
~109K SLoC