#[non_exhaustive]pub struct PanicInfo {
pub thread: Txt,
pub message: Txt,
pub file: Txt,
pub line: u32,
pub column: u32,
pub widget_path: Txt,
pub backtrace: Txt,
}Expand description
Panic parsed from a stderr dump.
§Compatibility
The parser can seek only the latest Rust stable panic format, to ensure compatibility call
PanicInfo::set_hook on the child process is possible.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.thread: TxtName of thread that panicked.
message: TxtPanic message.
file: TxtPath to file that defines the panic.
line: u32Line of code that defines the panic.
column: u32Column in the line of code that defines the panic.
widget_path: TxtWidget where the panic happened.
Only available in processes that use PanicInfo::set_hook.
backtrace: TxtStack backtrace.
Implementations§
Source§impl PanicInfo
impl PanicInfo
Sourcepub fn display_no_backtrace(&self) -> impl Display
pub fn display_no_backtrace(&self) -> impl Display
Returns an object that implements fmt::Display to write only the thread name, location, message and widget path.
Source§impl PanicInfo
impl PanicInfo
Sourcepub fn contains(stderr: &str) -> bool
pub fn contains(stderr: &str) -> bool
Gets if stderr contains a panic that can be parsed by find.
Sourcepub fn contains_widget(stderr: &str) -> bool
pub fn contains_widget(stderr: &str) -> bool
Gets if stderr contains a panic that can be parsed by find and traced a widget/window path.
Sourcepub fn find(stderr: &str) -> Option<Self>
pub fn find(stderr: &str) -> Option<Self>
Try parse stderr for the last panic printout.
Only reliably works if the panic fully printed correctly and was formatted by
PanicInfo::set_hook.
Sourcepub fn backtrace_frames(&self) -> impl Iterator<Item = BacktraceFrame> + '_
pub fn backtrace_frames(&self) -> impl Iterator<Item = BacktraceFrame> + '_
Iterate over frames parsed from the backtrace.
Source§impl PanicInfo
impl PanicInfo
Sourcepub fn set_hook(widget_trace_path: impl Fn() -> Txt + Send + Sync + 'static)
pub fn set_hook(widget_trace_path: impl Fn() -> Txt + Send + Sync + 'static)
Set a panic hook that will print panics to stderr in a format compatible with PanicInfo parsing.
The widget_trace_path should be a closure that return WIDGET.trace_path() if the process can run
an APP, otherwise it must be Txt::default.
The panic hook calls simply eprint_panic.
Sourcepub fn eprint_panic(info: &PanicHookInfo<'_>, widget_trace_path: &str)
pub fn eprint_panic(info: &PanicHookInfo<'_>, widget_trace_path: &str)
Trait Implementations§
Source§impl<'de> Deserialize<'de> for PanicInfo
impl<'de> Deserialize<'de> for PanicInfo
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for PanicInfo
Alternate mode {:#} writes raw backtrace without cleanup and code snippets.
impl Display for PanicInfo
Alternate mode {:#} writes raw backtrace without cleanup and code snippets.
See also PanicInfo::display_no_backtrace
impl Eq for PanicInfo
impl StructuralPartialEq for PanicInfo
Auto Trait Implementations§
impl Freeze for PanicInfo
impl RefUnwindSafe for PanicInfo
impl Send for PanicInfo
impl Sync for PanicInfo
impl Unpin for PanicInfo
impl UnsafeUnpin for PanicInfo
impl UnwindSafe for PanicInfo
Blanket Implementations§
Source§impl<T> AnyVarValue for T
impl<T> AnyVarValue for T
Source§fn clone_boxed(&self) -> BoxAnyVarValue
fn clone_boxed(&self) -> BoxAnyVarValue
Source§fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
fn eq_any(&self, other: &(dyn AnyVarValue + 'static)) -> bool
self and other are equal.Source§fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
fn try_swap(&mut self, other: &mut (dyn AnyVarValue + 'static)) -> bool
other if both are of the same type.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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
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>
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>
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