How to pretty print the BacktraceFrame

It seems std::backtrace::BacktraceFrame does not expose any pub fields or any method, I can just print it by {:?}. the output is a mess. Or is there some other way to capture backtrace ? thanks in advance.

You can print a single frame using BacktraceFrameFmt (created using BacktraceFmt::frame)

You can also use {:?} on a Backtrace value, which represents the entire backtrace and not just individual frames. The debug impl for Backtrace shows a nicely formatted backtrace, unlike the debug impl of BacktraceFrame.

This topic was automatically closed 90 days after the last reply. We invite you to open a new topic if you have further questions or comments.