Closed cyphar closed 4 years ago
I'm not sure what benefit this provides, since it basically locks users into a particular formatting and doesn't allow for any programmatic handling of backtraces [...] why a struct wrapper around
backtrace::Backtrace
is needed at all [...] is this done to try to avoid users depending onbacktrace::Backtrace
(given that it's intended to be in std eventually)?
That's correct. Backtrace
is in the standard library right now, available in nightly. SNAFU can use it via a feature flag as well. The long term plan is to only support that backtrace type as it's the one that std::error::Error
will use.
backtrace::Backtrace
is simply a stepping stone to that point. Wrapping it in a newtype allows the library to substitute any other implementation of a backtrace without breaking the public API.
I am passing the backtrace information via C FFI so that other languages can display backtrace information in whatever way makes sense for them
You may wish to start participating in the standard library discussions about the std::backtrace::Backtrace
type. There will probably be a period where SNAFU defaults to the standard library type but still supports the backtrace crate, but eventually it won't anymore. You will want the standard library to have gained whatever functionality you need by then.
I am passing the backtrace information via C FFI so that other languages can display backtrace information in whatever way makes sense for them
You may wish to start participating in the standard library discussions about the
std::backtrace::Backtrace
type. There will probably be a period where SNAFU defaults to the standard library type but still supports the backtrace crate, but eventually it won't anymore. You will want the standard library to have gained whatever functionality you need by then.
Thanks, I'll take a look at the current state of the std::error::Backtrace
design and make sure it supports all of the things I use in backtrace::Backtrace
.
EDIT: I missed
backtraces-impl-backtrace-crate
when looking at the feature flags. Sorry for the noise.