try-drop 0.2.0

Batteries included error handling mechanisms for drops which can fail
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
use try_drop::adapters::DropAdapter;
use try_drop::drop_strategies::{PanicDropStrategy, WriteDropStrategy};
use try_drop::test_utils::{ErrorsOnDrop, Random};

fn main() {
    let mut strategy = WriteDropStrategy::stderr();
    strategy.prelude("error: ");
    try_drop::install_global_handlers(strategy, PanicDropStrategy::DEFAULT);
    let errors = DropAdapter(ErrorsOnDrop::<Random, _>::not_given());
    println!("dropping now (will only error randomly)");
    drop(errors);
    println!("finished dropping");
}