try_drop/drop_strategies/abort.rs
1use crate::TryDropStrategy;
2use std::process;
3
4/// A drop strategy that aborts the program if the drop fails.
5#[cfg_attr(
6 feature = "derives",
7 derive(Debug, Copy, Clone, Ord, PartialOrd, Eq, PartialEq, Hash, Default)
8)]
9pub struct AbortDropStrategy;
10
11impl TryDropStrategy for AbortDropStrategy {
12 fn handle_error(&self, _error: crate::Error) {
13 process::abort()
14 }
15}
16
17// it is not possible to create tests for this strategy because this aborts the program, which
18// can't be caught.