parallel_processor/utils/panic_on_drop.rs
1pub struct PanicOnDrop(&'static str);
2
3impl PanicOnDrop {
4 pub fn new(message: &'static str) -> Self {
5 Self(message)
6 }
7
8 pub fn disengage(self) {
9 std::mem::forget(self);
10 }
11}
12
13impl Drop for PanicOnDrop {
14 fn drop(&mut self) {
15 panic!("Cannot drop value: {}", self.0);
16 }
17}