Skip to content

Commit

Permalink
Mirror std Error's deprecated methods on our Error trait
Browse files Browse the repository at this point in the history
Closes #425
  • Loading branch information
shepmaster committed Dec 22, 2023
1 parent bea7f27 commit c5fe470
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions src/no_std_error.rs
Original file line number Diff line number Diff line change
Expand Up @@ -3,12 +3,19 @@
use core::fmt::{Debug, Display};

pub trait Error: Debug + Display {
#[deprecated(since = "1.42.0", note = "use the Display impl or to_string()")]
fn description(&self) -> &str {
"description() is deprecated; use Display"
}

#[deprecated(
since = "1.33.0",
note = "replaced by Error::source, which can support downcasting"
)]
fn cause(&self) -> Option<&dyn Error> {
self.source()
}

fn source(&self) -> Option<&(dyn Error + 'static)> {
None
}
Expand Down

0 comments on commit c5fe470

Please sign in to comment.