pub struct PanicTracker;Expand description
Installs a panic hook that logs panics through tracing.
Implementations§
Source§impl PanicTracker
impl PanicTracker
Sourcepub fn install() -> PanicGuard
pub fn install() -> PanicGuard
Installs a global panic hook that records each panic via
tracing::error! inside a mytheclipse_panic_task span, then re-invokes
the previously-installed hook so default panic output (and any user
hook) still runs.
The application does not stop; the panic still unwinds normally, but a
trace is captured first. Returns a PanicGuard that restores the
previous hook when dropped.
Sourcepub fn catch<T>(f: impl FnOnce() -> T) -> Result<T, PanicInfo>
pub fn catch<T>(f: impl FnOnce() -> T) -> Result<T, PanicInfo>
Runs f, catching any panic and returning it as an
Err(PanicInfo) rather than unwinding across the caller.
Useful to isolate a panic inside a worker thread so it cannot bring down the rest of the process. The caller is responsible for deciding whether to continue after a caught panic.
Auto Trait Implementations§
impl Freeze for PanicTracker
impl RefUnwindSafe for PanicTracker
impl Send for PanicTracker
impl Sync for PanicTracker
impl Unpin for PanicTracker
impl UnsafeUnpin for PanicTracker
impl UnwindSafe for PanicTracker
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
impl<ST, DT> CastableFrom<ST, Initialized, Initialized> for DT
impl<ST, DT> CastableFrom<ST, Uninit, Uninit> for DT
Source§impl<T> Instrument for T
impl<T> Instrument for T
Source§fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
fn instrument(self, span: Span) -> Instrumented<Self> ⓘ
Source§fn in_current_span(self) -> Instrumented<Self> ⓘ
fn in_current_span(self) -> Instrumented<Self> ⓘ
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more