1
1
## color-eyre
2
2
3
+ [ ![ Build Status] [ actions-badge ]] [ actions-url ]
4
+ [ ![ Latest Version] [ version-badge ]] [ version-url ]
5
+ [ ![ Rust Documentation] [ docs-badge ]] [ docs-url ]
6
+
7
+ [ actions-badge ] : https://github.com/yaahc/color-eyre/workflows/Continuous%20integration/badge.svg
8
+ [ actions-url ] : https://github.com/yaahc/color-eyre/actions?query=workflow%3A%22Continuous+integration%22
9
+ [ version-badge ] : https://img.shields.io/crates/v/color-eyre.svg
10
+ [ version-url ] : https://crates.io/crates/color-eyre
11
+ [ docs-badge ] : https://img.shields.io/badge/docs-latest-blue.svg
12
+ [ docs-url ] : https://docs.rs/color-eyre
13
+
3
14
A custom context for the [ ` eyre ` ] crate for colorful error reports, suggestions,
4
15
and [ ` tracing-error ` ] support.
5
16
@@ -37,28 +48,6 @@ eyre = "0.3.8"
37
48
color-eyre = { version = " 0.1" , default-features = false }
38
49
```
39
50
40
- ## Explanation
41
-
42
- This crate works by defining a ` Context ` type which implements [ ` eyre::EyreContext ` ]
43
- and a pair of type aliases for setting this context type as the parameter of
44
- [ ` eyre::Report ` ] .
45
-
46
- ``` rust
47
- use color_eyre :: Context ;
48
-
49
- pub type Report = eyre :: Report <Context >;
50
- pub type Result <T , E = Report > = core :: result :: Result <T , E >;
51
- ```
52
-
53
- ## Features
54
-
55
- - captures a [ ` backtrace::Backtrace ` ] and prints using [ ` color-backtrace ` ]
56
- - captures a [ ` tracing_error::SpanTrace ` ] and prints using
57
- [ ` color-spantrace ` ]
58
- - Only capture SpanTrace by default for better performance.
59
- - display source lines when ` RUST_LIB_BACKTRACE=full ` is set
60
- - store help text via [ ` Help ` ] trait and display after final report
61
-
62
51
## Example
63
52
64
53
``` rust,should_panic
@@ -110,6 +99,29 @@ fn read_config() -> Result<(), Report> {
110
99
111
100
![ full report format] ( ./pictures/full.png )
112
101
102
+ ## Explanation
103
+
104
+ This crate works by defining a ` Context ` type which implements [ ` eyre::EyreContext ` ]
105
+ and a pair of type aliases for setting this context type as the parameter of
106
+ [ ` eyre::Report ` ] .
107
+
108
+ ``` rust
109
+ use color_eyre :: Context ;
110
+
111
+ pub type Report = eyre :: Report <Context >;
112
+ pub type Result <T , E = Report > = core :: result :: Result <T , E >;
113
+ ```
114
+
115
+ ## Features
116
+
117
+ - captures a [ ` backtrace::Backtrace ` ] and prints using [ ` color-backtrace ` ]
118
+ - captures a [ ` tracing_error::SpanTrace ` ] and prints using
119
+ [ ` color-spantrace ` ]
120
+ - Only capture SpanTrace by default for better performance.
121
+ - display source lines when ` RUST_LIB_BACKTRACE=full ` is set
122
+ - store help text via [ ` Help ` ] trait and display after final report
123
+
124
+
113
125
[ `eyre` ] : https://docs.rs/eyre
114
126
[ `tracing-error` ] : https://docs.rs/tracing-error
115
127
[ `color-backtrace` ] : https://docs.rs/color-backtrace
@@ -120,3 +132,18 @@ fn read_config() -> Result<(), Report> {
120
132
[ `Help` ] : trait.Help.html
121
133
[ `eyre::Report` ] : https://docs.rs/eyre/0.3.8/eyre/struct.Report.html
122
134
[ `eyre::Result` ] : https://docs.rs/eyre/0.3.8/eyre/type.Result.html
135
+
136
+ #### License
137
+
138
+ <sup >
139
+ Licensed under either of <a href =" LICENSE-APACHE " >Apache License, Version
140
+ 2.0</a > or <a href =" LICENSE-MIT " >MIT license</a > at your option.
141
+ </sup >
142
+
143
+ <br >
144
+
145
+ <sub >
146
+ Unless you explicitly state otherwise, any contribution intentionally submitted
147
+ for inclusion in this crate by you, as defined in the Apache-2.0 license, shall
148
+ be dual licensed as above, without any additional terms or conditions.
149
+ </sub >
0 commit comments