Skip to content

Commit a0823eb

Browse files
committed
organize consistently
1 parent d5195a9 commit a0823eb

File tree

2 files changed

+72
-44
lines changed

2 files changed

+72
-44
lines changed

README.md

Lines changed: 49 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,16 @@
11
## color-eyre
22

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+
314
A custom context for the [`eyre`] crate for colorful error reports, suggestions,
415
and [`tracing-error`] support.
516

@@ -37,28 +48,6 @@ eyre = "0.3.8"
3748
color-eyre = { version = "0.1", default-features = false }
3849
```
3950

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-
6251
## Example
6352

6453
```rust,should_panic
@@ -110,6 +99,29 @@ fn read_config() -> Result<(), Report> {
11099

111100
![full report format](./pictures/full.png)
112101

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+
113125
[`eyre`]: https://docs.rs/eyre
114126
[`tracing-error`]: https://docs.rs/tracing-error
115127
[`color-backtrace`]: https://docs.rs/color-backtrace
@@ -120,3 +132,18 @@ fn read_config() -> Result<(), Report> {
120132
[`Help`]: trait.Help.html
121133
[`eyre::Report`]: https://docs.rs/eyre/0.3.8/eyre/struct.Report.html
122134
[`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>

src/lib.rs

Lines changed: 23 additions & 22 deletions
Original file line numberDiff line numberDiff line change
@@ -35,28 +35,6 @@
3535
//! color-eyre = { version = "0.1", default-features = false }
3636
//! ```
3737
//!
38-
//! ## Explanation
39-
//!
40-
//! This crate works by defining a `Context` type which implements [`eyre::EyreContext`]
41-
//! and a pair of type aliases for setting this context type as the parameter of
42-
//! [`eyre::Report`].
43-
//!
44-
//! ```rust
45-
//! use color_eyre::Context;
46-
//!
47-
//! pub type Report = eyre::Report<Context>;
48-
//! pub type Result<T, E = Report> = core::result::Result<T, E>;
49-
//! ```
50-
//!
51-
//! ## Features
52-
//!
53-
//! - captures a [`backtrace::Backtrace`] and prints using [`color-backtrace`]
54-
//! - captures a [`tracing_error::SpanTrace`] and prints using
55-
//! [`color-spantrace`]
56-
//! - Only capture SpanTrace by default for better performance.
57-
//! - display source lines when `RUST_LIB_BACKTRACE=full` is set
58-
//! - store help text via [`Help`] trait and display after final report
59-
//!
6038
//! ## Example
6139
//!
6240
//! ```rust,should_panic
@@ -108,6 +86,29 @@
10886
//!
10987
//! ![full report format](./pictures/full.png)
11088
//!
89+
//! ## Explanation
90+
//!
91+
//! This crate works by defining a `Context` type which implements [`eyre::EyreContext`]
92+
//! and a pair of type aliases for setting this context type as the parameter of
93+
//! [`eyre::Report`].
94+
//!
95+
//! ```rust
96+
//! use color_eyre::Context;
97+
//!
98+
//! pub type Report = eyre::Report<Context>;
99+
//! pub type Result<T, E = Report> = core::result::Result<T, E>;
100+
//! ```
101+
//!
102+
//! ## Features
103+
//!
104+
//! - captures a [`backtrace::Backtrace`] and prints using [`color-backtrace`]
105+
//! - captures a [`tracing_error::SpanTrace`] and prints using
106+
//! [`color-spantrace`]
107+
//! - Only capture SpanTrace by default for better performance.
108+
//! - display source lines when `RUST_LIB_BACKTRACE=full` is set
109+
//! - store help text via [`Help`] trait and display after final report
110+
//!
111+
//!
111112
//! [`eyre`]: https://docs.rs/eyre
112113
//! [`tracing-error`]: https://docs.rs/tracing-error
113114
//! [`color-backtrace`]: https://docs.rs/color-backtrace

0 commit comments

Comments
 (0)