Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix documentation mentioning backtrace() method #197

Merged
merged 1 commit into from Sep 27, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
9 changes: 5 additions & 4 deletions README.md
Expand Up @@ -124,8 +124,8 @@ pub enum DataStoreError {
}
```

- The Error trait's `backtrace()` method is implemented to return whichever
field has a type named `Backtrace`, if any.
- The Error trait's `provide()` method is implemented to provide whichever field
has a type named `Backtrace`, if any, as a `std::backtrace::Backtrace`.

```rust
use std::backtrace::Backtrace;
Expand All @@ -138,8 +138,9 @@ pub enum DataStoreError {
```

- If a field is both a source (named `source`, or has `#[source]` or `#[from]`
attribute) *and* is marked `#[backtrace]`, then the Error trait's
`backtrace()` method is forwarded to the source's backtrace.
attribute) *and* is marked `#[backtrace]`, then the Error trait's `provide()`
method is forwarded to the source's `provide` so that both layers of the error
share the same backtrace.

```rust
#[derive(Error, Debug)]
Expand Down
8 changes: 5 additions & 3 deletions src/lib.rs
Expand Up @@ -146,8 +146,9 @@
//! # }
//! ```
//!
//! - The Error trait's `backtrace()` method is implemented to return whichever
//! field has a type named `Backtrace`, if any.
//! - The Error trait's `provide()` method is implemented to provide whichever
//! field has a type named `Backtrace`, if any, as a
//! `std::backtrace::Backtrace`.
//!
//! ```rust
//! # const IGNORE: &str = stringify! {
Expand All @@ -163,7 +164,8 @@
//!
//! - If a field is both a source (named `source`, or has `#[source]` or
//! `#[from]` attribute) *and* is marked `#[backtrace]`, then the Error
//! trait's `backtrace()` method is forwarded to the source's backtrace.
//! trait's `provide()` method is forwarded to the source's `provide` so that
//! both layers of the error share the same backtrace.
//!
//! ```rust
//! # const IGNORE: &str = stringify! {
Expand Down