diff --git a/CHANGELOG.md b/CHANGELOG.md index 3fbcb2c..22ff572 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -11,6 +11,10 @@ and this project adheres to [Semantic Versioning](http://semver.org/). * For `Runner::input_byte` the buffer `B` does not need to be `Sized` +### Added + +* `impl core::error::Error for Error` on rust >= 1.81 + ## [v0.6.0] - 2024-08-30 ### Changed diff --git a/Cargo.toml b/Cargo.toml index 38465b3..0ef08e3 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -11,6 +11,7 @@ readme = "README.md" [dependencies] embedded-io = "0.6.1" noline = { version = "0.5.0", optional = true } +rustversion = "1.0.17" [features] default = ["echo"] diff --git a/src/lib.rs b/src/lib.rs index 00159c4..e7cfc7d 100644 --- a/src/lib.rs +++ b/src/lib.rs @@ -127,6 +127,15 @@ pub enum Error { NotFound, } +impl core::fmt::Display for Error { + fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result { + core::fmt::Debug::fmt(self, f) + } +} + +#[rustversion::since(1.81)] +impl core::error::Error for Error {} + /// Looks for the named parameter in the parameter list of the item, then /// finds the correct argument. ///