rust-lang / backtrace-rs

Backtraces in Rust
https://docs.rs/backtrace
Other
530 stars 245 forks source link

implement From<Frame> for BacktraceFrame #420

Closed glommer closed 3 years ago

glommer commented 3 years ago

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

alexcrichton commented 3 years ago

Thanks! Can you add some tests for this as well?

glommer commented 3 years ago

I can, but I noticed that there aren't any tests in-file. What kind of tests exactly are you looking for here?

alexcrichton commented 3 years ago

Mostly just something that exercises this code. For example creating a list from a call to backtrace::trace and then after the trace is finished the frames are inspected.

glommer commented 3 years ago

test added

alexcrichton commented 3 years ago

Looks good to me, thanks!