Crates.io | nounwind |
lib.rs | nounwind |
version | 0.1.0 |
created_at | 2025-09-11 18:49:35.128322+00 |
updated_at | 2025-09-11 18:49:35.128322+00 |
description | A attribute macro to prevent panics from unwinding, similar to C++ noexcept |
homepage | |
repository | https://github.com/Techcable/nounwind.rs |
max_upload_size | |
id | 1834346 |
size | 30,475 |
Defines a #[nounwind]
attribute macro that prevents panics from unwinding,
similar to the C++ noexcept
specifier.
This is clearer than using a drop guard, and in some versions of Rust can provide a better error message. In particular, aborting panics will often print a messages like "panic in a function that cannot unwind", although this behavior is version-specific and not guaranteed to occur.
The crate also provides a polyfill for the nightly std::panic::abort_unwind
function.
The #[noexcept]
attribute is implemented in terms of this function.
On older versions, this requires use of libabort
to abort the program.
This is necessary to support aborts in #[no_std]
mode.
Enabling the std
feature simply makes libabort delegate to std::process::abort
.
Licensed under either the Apache 2.0 License or MIT License at your option.
Unless you explicitly state otherwise, any contribution intentionally submitted for inclusion in this project by you, as defined in the Apache-2.0 license, shall be dual licensed as above, without any additional terms or conditions.