Crates.io | dont_panic |
lib.rs | dont_panic |
version | 0.1.0 |
source | src |
created_at | 2017-07-06 20:27:39.31031 |
updated_at | 2017-07-06 20:27:39.31031 |
description | panic!()-like macro that causes linking error instead of panicking. May be used to statically ensure some code won't panic. |
homepage | https://github.com/Kixunil/dont_panic |
repository | https://github.com/Kixunil/dont_panic |
max_upload_size | |
id | 22235 |
size | 4,003 |
Ensure that code can't panic at compile time.
This code will compile and (not) run just fine:
let should_panic = false;
if should_panic {
dont_panic!("This will never execute.");
}
However, this code will cause linking error:
let should_panic = true;
if should_panic {
dont_panic!("This will never execute.");
}