Skip to content

Commit 2572659

Browse files
committed
implement From<Frame> for BacktraceFrame
There are situations where we can only capture raw `Frame` (example: capturing from a signal handler), but it could still be that we can process them later and are not fully nostd in the environment. With a conversion from Frame to BacktraceFrame, this is trivial. But without it, we can't really use the pretty printers as they are reliant on BacktraceFrame, not Frame. Fixes: #419
1 parent 221483e commit 2572659

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/capture.rs

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -249,6 +249,15 @@ impl From<Vec<BacktraceFrame>> for Backtrace {
249249
}
250250
}
251251

252+
impl From<crate::Frame> for BacktraceFrame {
253+
fn from(frame: crate::Frame) -> BacktraceFrame {
254+
BacktraceFrame {
255+
frame: Frame::Raw(frame),
256+
symbols: None,
257+
}
258+
}
259+
}
260+
252261
impl Into<Vec<BacktraceFrame>> for Backtrace {
253262
fn into(self) -> Vec<BacktraceFrame> {
254263
self.frames

0 commit comments

Comments
 (0)