use std::sync::{MutexGuard, PoisonError};
pub trait GuardRecovery<'a, T> {
fn recover(self) -> MutexGuard<'a, T>;
}
impl<'a, T> GuardRecovery<'a, T>
for Result<MutexGuard<'a, T>, PoisonError<MutexGuard<'a, T>>>
{
fn recover(self) -> MutexGuard<'a, T> {
match self {
Ok(inner) => inner,
Err(poisoned) => poisoned.into_inner(),
}
}
}