snafu
snafu copied to clipboard
Allow iter_chain to be used on no_std
Hello!
This change will allow no_std
users of snafu to make use of snafu's ErrorCompat::iter_chain
function. Usage remains exactly the same as before.
I could not figure out an easy way to write an automatic test for this since the cargo test harness needs std
(hence the test
portion of these cfg attributes which already exist in the codebase #[cfg(not(any(feature = "std", test)))]
)
Here is the code I have used to test whether the feature works or not: https://github.com/OliverUv/snafu_api_experiment - it is a little larger than a minimal example since it also contains a small experiment to hack in dyn trait source errors. The relevant code is L114-157 of main.rs ( https://github.com/OliverUv/snafu_api_experiment/blob/7127727fb6a2efe6ecaa85c292309dfaff9e0aa9/src/main.rs#L114 )
Deploy Preview for shepmaster-snafu ready!
Name | Link |
---|---|
Latest commit | 6ca4bbcb684bdc75b1d74d1541b0d3e7aab670f6 |
Latest deploy log | https://app.netlify.com/sites/shepmaster-snafu/deploys/63221daa8c50ef00084d3240 |
Deploy Preview | https://deploy-preview-343--shepmaster-snafu.netlify.app |
Preview on mobile | Toggle QR Code...Use your smartphone camera to open QR code link. |
To edit notification comments on pull requests, go to your Netlify site settings.
I've force-pushed some changes as the crate already has an alias for Error
:
https://github.com/shepmaster/snafu/blob/b552522ca92031a4450c914dce114013af383b7c/src/lib.rs#L324-L332
Can you double-check that this still works for your original case?
I've rebased on main
after taking care of some tangentially-related CI failures.
I pulled down your repo and it appeared to work well with the changes I made, so I'll go ahead and merge. Thanks!