pub enum PoolError<E> {
Factory(E),
Panic(PanicError),
}Expand description
A factory failure or an unwinding panic during a pool operation.
Variants§
Factory(E)
The factory returned an error without panicking.
Panic(PanicError)
The operation panicked and its payload was captured.
Implementations§
Source§impl<E> PoolError<E>
impl<E> PoolError<E>
Sourcepub fn catch<T>(operation: impl FnOnce() -> Result<T, E>) -> Result<T, Self>
pub fn catch<T>(operation: impl FnOnce() -> Result<T, E>) -> Result<T, Self>
Run an operation, preserving factory errors and capturing unwind panics.
The operation must leave any externally observable state valid when it unwinds. Panics configured to abort and panics in the panic hook cannot be captured.
§Errors
Returns Self::Factory for a returned error or Self::Panic for an
unwinding panic. Successful work completed before a panic is retained.
Trait Implementations§
Source§impl<E: Error + 'static> Error for PoolError<E>
impl<E: Error + 'static> Error for PoolError<E>
Source§fn source(&self) -> Option<&(dyn Error + 'static)>
fn source(&self) -> Option<&(dyn Error + 'static)>
Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§fn description(&self) -> &str
fn description(&self) -> &str
👎Deprecated since 1.42.0:
use the Display impl or to_string()
Auto Trait Implementations§
impl<E> !Freeze for PoolError<E>
impl<E> RefUnwindSafe for PoolError<E>where
E: RefUnwindSafe,
impl<E> Send for PoolError<E>where
E: Send,
impl<E> Sync for PoolError<E>where
E: Sync,
impl<E> Unpin for PoolError<E>where
E: Unpin,
impl<E> UnsafeUnpin for PoolError<E>where
E: UnsafeUnpin,
impl<E> UnwindSafe for PoolError<E>where
E: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more