Struct poison_guard::PoisonRecover
source · [−]pub struct PoisonRecover<'a, T, Target = &'a mut Poison<T>> { /* private fields */ }
Expand description
A guard for a poisoned value.
Implementations
sourceimpl<'a, T, Target> PoisonRecover<'a, T, Target> where
Target: DerefMut<Target = Poison<T>>,
impl<'a, T, Target> PoisonRecover<'a, T, Target> where
Target: DerefMut<Target = Poison<T>>,
sourcepub fn recover(self) -> PoisonGuard<'a, T, Target>
pub fn recover(self) -> PoisonGuard<'a, T, Target>
Recover a poisoned value.
This method won’t make any changes to the underlying value. After this call, any future accesses to the value will succeed.
sourcepub fn recover_with(self, f: impl FnOnce(&mut T)) -> PoisonGuard<'a, T, Target>
pub fn recover_with(self, f: impl FnOnce(&mut T)) -> PoisonGuard<'a, T, Target>
Recover a poisoned value with the given closure.
After this call, any future accesses to the value will succeed.
sourcepub fn try_recover_with<E>(
self,
f: impl FnOnce(&mut T) -> Result<(), E>
) -> Result<PoisonGuard<'a, T, Target>, PoisonRecover<'a, T, Target>> where
E: Into<Box<dyn Error + Send + Sync>>,
pub fn try_recover_with<E>(
self,
f: impl FnOnce(&mut T) -> Result<(), E>
) -> Result<PoisonGuard<'a, T, Target>, PoisonRecover<'a, T, Target>> where
E: Into<Box<dyn Error + Send + Sync>>,
Try recover a poisoned value with the given closure.
If this call succeeds, any future accesses to the value will succeed.
sourcepub fn into_error(self) -> PoisonError
pub fn into_error(self) -> PoisonError
Convert this recovery guard into an error.
Trait Implementations
sourceimpl<'a, T, Target> AsRef<dyn Error + Send + Sync + 'static> for PoisonRecover<'a, T, Target> where
Target: Deref<Target = Poison<T>>,
impl<'a, T, Target> AsRef<dyn Error + Send + Sync + 'static> for PoisonRecover<'a, T, Target> where
Target: Deref<Target = Poison<T>>,
sourceimpl<'a, T, Target> Debug for PoisonRecover<'a, T, Target> where
Target: Deref<Target = Poison<T>>,
impl<'a, T, Target> Debug for PoisonRecover<'a, T, Target> where
Target: Deref<Target = Poison<T>>,
sourceimpl<'a, T, Target> Display for PoisonRecover<'a, T, Target> where
Target: Deref<Target = Poison<T>>,
impl<'a, T, Target> Display for PoisonRecover<'a, T, Target> where
Target: Deref<Target = Poison<T>>,
sourceimpl<'a, T, Target> From<PoisonRecover<'a, T, Target>> for Box<dyn Error + 'static> where
Target: Deref<Target = Poison<T>>,
impl<'a, T, Target> From<PoisonRecover<'a, T, Target>> for Box<dyn Error + 'static> where
Target: Deref<Target = Poison<T>>,
sourcefn from(guard: PoisonRecover<'a, T, Target>) -> Self
fn from(guard: PoisonRecover<'a, T, Target>) -> Self
Converts to this type from the input type.
sourceimpl<'a, T, Target> From<PoisonRecover<'a, T, Target>> for Box<dyn Error + Send + 'static> where
Target: Deref<Target = Poison<T>>,
impl<'a, T, Target> From<PoisonRecover<'a, T, Target>> for Box<dyn Error + Send + 'static> where
Target: Deref<Target = Poison<T>>,
sourcefn from(guard: PoisonRecover<'a, T, Target>) -> Self
fn from(guard: PoisonRecover<'a, T, Target>) -> Self
Converts to this type from the input type.
sourceimpl<'a, T, Target> From<PoisonRecover<'a, T, Target>> for Box<dyn Error + Send + Sync + 'static> where
Target: Deref<Target = Poison<T>>,
impl<'a, T, Target> From<PoisonRecover<'a, T, Target>> for Box<dyn Error + Send + Sync + 'static> where
Target: Deref<Target = Poison<T>>,
sourcefn from(guard: PoisonRecover<'a, T, Target>) -> Self
fn from(guard: PoisonRecover<'a, T, Target>) -> Self
Converts to this type from the input type.
sourceimpl<'a, T, Target> From<PoisonRecover<'a, T, Target>> for PoisonError where
Target: Deref<Target = Poison<T>>,
impl<'a, T, Target> From<PoisonRecover<'a, T, Target>> for PoisonError where
Target: Deref<Target = Poison<T>>,
sourcefn from(guard: PoisonRecover<'a, T, Target>) -> Self
fn from(guard: PoisonRecover<'a, T, Target>) -> Self
Converts to this type from the input type.
impl<'a, T, Target> UnwindSafe for PoisonRecover<'a, T, Target> where
Target: DerefMut<Target = Poison<T>>,
Auto Trait Implementations
impl<'a, T, Target> RefUnwindSafe for PoisonRecover<'a, T, Target> where
T: RefUnwindSafe,
Target: RefUnwindSafe,
impl<'a, T, Target> Send for PoisonRecover<'a, T, Target> where
T: Send,
Target: Send,
impl<'a, T, Target> Sync for PoisonRecover<'a, T, Target> where
T: Sync,
Target: Sync,
impl<'a, T, Target> Unpin for PoisonRecover<'a, T, Target> where
Target: Unpin,
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more