pub struct ErrorRegistry { /* private fields */ }Expand description
A synchronized, type-checked registry for a single error value.
Under std, stored errors are owned by a Mutex and retrieved using a
checked core::any::Any downcast. A request for a different type returns
None. Under no_std, where this crate has no synchronization primitive
capable of owning an arbitrary allocation, the registry records only
whether an error occurred.
Implementations§
Source§impl ErrorRegistry
impl ErrorRegistry
Sourcepub fn store<E>(&self, error: E)where
E: Send + 'static,
pub fn store<E>(&self, error: E)where
E: Send + 'static,
Store an error in the registry, replacing the previous value.
Errors must be owned and safe to move between threads because the registry is process-global. The replaced value is dropped after the registry lock is released so user-defined destructors cannot deadlock the registry by re-entering it.
Trait Implementations§
Source§impl Default for ErrorRegistry
impl Default for ErrorRegistry
Source§impl Drop for ErrorRegistry
impl Drop for ErrorRegistry
Auto Trait Implementations§
impl !Freeze for ErrorRegistry
impl RefUnwindSafe for ErrorRegistry
impl Send for ErrorRegistry
impl Sync for ErrorRegistry
impl Unpin for ErrorRegistry
impl UnsafeUnpin for ErrorRegistry
impl UnwindSafe for ErrorRegistry
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