assert_panic_free 1.0.2

Assert that some code is panic-free. Fast to compile, no syn or macros etc...
Documentation
  • Coverage
  • 50%
    1 out of 2 items documented1 out of 1 items with examples
  • Size
  • Source code size: 3.36 kB This is the summed size of all the files inside the crates.io package for this release.
  • Documentation size: 473.87 kB This is the summed size of all files generated by rustdoc for all configured targets
  • Ø build duration
  • this release: 8s Average build duration of successful builds.
  • all releases: 8s Average build duration of successful builds in releases after 2024-10-23.
  • Links
  • Homepage
  • spacejam/assert_panic_free
    16 0 0
  • crates.io
  • Dependencies
  • Versions
  • Owners
  • spacejam

assert_panic_free

A lightweight higher-order-function that doesn't compile if a function you pass to it might panic. This probably wont' work unless you're compiling your code with optimizations enabled.

Example

works when built with optimizations / release:

assert_panic_free::assert_panic_free(|| 32);

doesn't work:

assert_panic_free(|| panic!(":("));

Inspired by no_panic and panic_never but I wanted something that allowed for fine-grained panic reduction (like no_panic) but also something that compiled fast (like panic_never).