bare_err_tree
To repost the README: bare_err_tree
is a no_std
+ no alloc
library to print a standard Error
with a tree of sources.
Example output:
missed class
├─ at src/bin/example.rs:26:6
│
╰─▶ stayed in bed too long
├─ at src/bin/example.rs:18:57
│
├─▶ bed is comfortable
│
╰─▶ went to sleep at 2 A.M.
├─ at src/bin/example.rs:18:72
│
├─▶ finishing a project
│ │
│ ╰─▶ proving 1 == 2
│
├─▶ stressed about exams
│
╰─▶ playing video games
Why?
The Error trait only supports one source error, but (especially multiprocess) code can have more than one underlying source per Error node. I tried using error-stack, but the Report wrapper got in the way of regular Error matching (I appreciate TimDiekmann's consideration and discussion, however).
This library exists so to get more useful output without getting in the way of regular Error handling. This works by implementing AsErrTree
on existing types, and opting-in to the special display via a function call. No wrappers even necessary for struct types!
Why no-std
and no alloc
?
Largely because I can. It also specifically enables writing out JSON on a bare metal embedded device's serial connections, which I intend to use for some personal projects.
What's Blocking 1.0?
Mostly just answering this question. I also want to share it around and leave a little time to find any glaring API mistakes.
I hope this looks interesting to everyone! I'm happy to take comments and answer questions. I have other open source crates at various stages of progress, but this is the first one I'm ready to advertise as ready for use.