pub fn tree_unwrap<const FRONT_MAX: usize, T, E>(res: Result<T, E>) -> Twhere
E: AsErrTree,
Expand description
Alternative to Result::unwrap
that formats the error as a tree.
FRONT_MAX
limits the number of leading bytes. Each deeper error requires 6
bytes to fit “│ “. So for a max depth of 3 errors, FRONT_MAX
== 18.
By default, FRONT_MAX
bytes are allocated on stack. When heap_buffer
is
enabled, the bytes are allocated on heap and FRONT_MAX
only acts as a
depth limit. When tracing
is enabled, at most FRONT_MAX
stack traces
will be tracked for duplicates.
Errors must define Error::source
correctly for the tree to display.
The derive macros for ErrTree
track extra information and handle
multiple sources (Error::source
is designed around a single error
source).