chain_display with alternate format for linebreaks and backtraces
This is a riff on #233, prototype based on discussions of that PR.
-
Uses
chain_display() -> ChainDisplayas rename ofdisplay() -> FailDisplay -
Adds a convenient top level
failure::chain_displayfunction, which simplifies usage (see examples/simple changes). -
Uses single line format for "{}" and multiple lines with backtraces for (
alternate== true) "{:#}". -
Propagates alternate format selection to Fail types
Display::fmt. -
Extends examples/simple.rs with all output variants. (There is not unit or doctests yet to riff on.)
-
Adds a example/custom.rs which might demonstrate a typical double (but not particularly harmful) output of an inner error, based on current usage.
As another improvement (beyond #233) add (as of 37dafed) a Debug implementation for ChainDisplay as well.
Formal rationale: As Fail requires Debug, so should ChainDisplay be Debug.
Practical reasoning: Users are likely to want this when println! debugging applications.
Like with the alternate Display format, Debug formatting is propagated to each Fail in the chain.