pair 0.2.0

Safe API for generic self-referential pairs of owner and dependent.
Documentation
1
2
3
4
5
6
7
8
9
/// A simple struct that runs a closure on drop. Used to clean up resources
/// during panic unwinding within [`Pair`](crate::pair).
pub struct DropGuard<F: FnMut()>(pub F);

impl<F: FnMut()> Drop for DropGuard<F> {
    fn drop(&mut self) {
        (self.0)();
    }
}