panic-write 0.1.0

Write panic messages to a core::fmt::Write and then halt
Documentation
  • Coverage
  • 50%
    2 out of 4 items documented0 out of 3 items with examples
  • Size
  • Source code size: 16.65 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 790.34 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Links
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • icewind1991

panic-write

Write panic messages to a core::fmt::Write and then halt, intended for bare metal development.

Usage

#![no_std]

use panic_write::PanicHandler;
use core::fmt::Write;

let serial = ...;
// assign the handler to an unused variable to stop it from getting dropped
let _panic_handler = PanicHandler::new(serial);

The panic handler is un-registered when dropped, if no active panic handler is registered and the app panics, it will halt without printing anything.

Additionally, the panic handler can also be used in place of the original Write throughout the rest of the app.

#![no_std]

use panic_write::PanicHandler;
use core::fmt::Write;

let serial = ...;
let mut serial = PanicHandler::new(serial);

writeln!(&mut serial, "starting app");