diff --git a/README.md b/README.md index 4f9bd59..fdb6971 100644 --- a/README.md +++ b/README.md @@ -43,7 +43,7 @@ eyre = "1.0" application was in the middle of. ```rust - use eyre::{Context, Result}; + use eyre::{Report, Result}; fn main() -> Result<()> { ... diff --git a/src/context.rs b/src/context.rs index 0e4345e..7dc631f 100644 --- a/src/context.rs +++ b/src/context.rs @@ -1,5 +1,5 @@ use crate::error::ContextError; -use crate::{Context, ErrReport, StdError}; +use crate::{Report, ErrReport, StdError}; use core::convert::Infallible; use core::fmt::{self, Debug, Display, Write}; @@ -39,7 +39,7 @@ mod ext { } } -impl Context for Result +impl Report for Result where E: ext::StdError + Send + Sync + 'static, { @@ -62,7 +62,7 @@ where /// ``` /// # type T = (); /// # -/// use eyre::{Context, Result}; +/// use eyre::{Report, Result}; /// /// fn maybe_get() -> Option { /// # const IGNORE: &str = stringify! { @@ -79,7 +79,7 @@ where /// # unimplemented!() /// } /// ``` -impl Context for Option { +impl Report for Option { fn context(self, context: C) -> Result where C: Display + Send + Sync + 'static, diff --git a/src/error.rs b/src/error.rs index 23c374e..8ef970b 100644 --- a/src/error.rs +++ b/src/error.rs @@ -208,11 +208,11 @@ impl ErrReport { /// Wrap the error value with additional context. /// /// For attaching context to a `Result` as it is propagated, the - /// [`Context`][crate::Context] extension trait may be more convenient than + /// [`Report`][crate::Report] extension trait may be more convenient than /// this function. /// /// The primary reason to use `error.context(...)` instead of - /// `result.context(...)` via the `Context` trait would be if the context + /// `result.context(...)` via the `Report` trait would be if the context /// needs to depend on some data held by the underlying error: /// /// ``` @@ -349,7 +349,7 @@ impl ErrReport { /// context has been attached. For details about the interaction between /// context and downcasting, [see here]. /// - /// [see here]: trait.Context.html#effect-on-downcasting + /// [see here]: trait.Report.html#effect-on-downcasting pub fn is(&self) -> bool where E: Display + Debug + Send + Sync + 'static, diff --git a/src/lib.rs b/src/lib.rs index 8621113..a41f39f 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -52,7 +52,7 @@ //! # } //! # } //! # -//! use eyre::{Context, Result}; +//! use eyre::{Report, Result}; //! //! fn main() -> Result<()> { //! # return Ok(()); @@ -273,7 +273,7 @@ pub use eyre as format_err; /// at /git/eyre/src/backtrace.rs:26 /// 1: core::result::Result::map_err /// at /git/rustc/src/libcore/result.rs:596 -/// 2: eyre::context:: for core::result::Result>::with_context +/// 2: eyre::context:: for core::result::Result>::with_context /// at /git/eyre/src/context.rs:58 /// 3: testing::main /// at src/main.rs:5 @@ -302,7 +302,7 @@ pub use eyre as format_err; /// like this: /// /// ``` -/// use eyre::{Context, Result}; +/// use eyre::{Report, Result}; /// /// fn main() { /// if let Err(err) = try_main() { @@ -352,7 +352,7 @@ pub struct Chain<'a> { /// /// This is a reasonable return type to use throughout your application but also /// for `fn main`; if you do, failures will be printed along with any -/// [context][Context] and a backtrace if one was captured. +/// [context][Report] and a backtrace if one was captured. /// /// `eyre::Result` may be used with one *or* two type parameters. /// @@ -409,7 +409,7 @@ pub type Result = core::result::Result; /// # Example /// /// ``` -/// use eyre::{Context, Result}; +/// use eyre::{Report, Result}; /// use std::fs; /// use std::path::PathBuf; /// @@ -479,7 +479,7 @@ pub type Result = core::result::Result; /// # bail!(SuspiciousError); /// # } /// # -/// use eyre::{Context, Result}; +/// use eyre::{Report, Result}; /// /// fn do_it() -> Result<()> { /// helper().context("Failed to complete the work")?; @@ -519,7 +519,7 @@ pub type Result = core::result::Result; /// # bail!("no such file or directory"); /// # } /// # -/// use eyre::{Context, Result}; +/// use eyre::{Report, Result}; /// /// fn do_it() -> Result<()> { /// helper().context(HelperFailed)?; @@ -540,7 +540,7 @@ pub type Result = core::result::Result; /// # panic!("expected downcast to succeed"); /// } /// ``` -pub trait Context: context::private::Sealed { +pub trait Report: context::private::Sealed { /// Wrap the error value with additional context. fn context(self, context: C) -> Result where diff --git a/tests/test_context.rs b/tests/test_context.rs index de67d8e..f7849bf 100644 --- a/tests/test_context.rs +++ b/tests/test_context.rs @@ -1,7 +1,7 @@ mod drop; use crate::drop::{DetectDrop, Flag}; -use eyre::{Context, ErrReport, Result}; +use eyre::{Report, ErrReport, Result}; use std::fmt::{self, Display}; use thiserror::Error; @@ -68,7 +68,7 @@ fn make_chain() -> (ErrReport, Dropped) { drop: DetectDrop::new(&dropped.low), }; - // impl Context for Result + // impl Report for Result let mid = Err::<(), LowLevel>(low) .context(MidLevel { message: "failed to load config", @@ -76,7 +76,7 @@ fn make_chain() -> (ErrReport, Dropped) { }) .unwrap_err(); - // impl Context for Result + // impl Report for Result let high = Err::<(), ErrReport>(mid) .context(HighLevel { message: "failed to start server", diff --git a/tests/test_fmt.rs b/tests/test_fmt.rs index 4005af3..f2af55d 100644 --- a/tests/test_fmt.rs +++ b/tests/test_fmt.rs @@ -1,4 +1,4 @@ -use eyre::{bail, Context, Result}; +use eyre::{bail, Report, Result}; use std::io; fn f() -> Result<()> {