diff --git a/CHANGELOG.md b/CHANGELOG.md index 9225845..c673716 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0. - Add `start()` and `end()` method to the `Region` trait. - Much faster `OverlapIterator`. +- Add optional `defmt` attribute for `NorFlashErrorKind` gated by a new feature `defmt-03`. ## [0.3.1] - 2023-12-04 diff --git a/Cargo.toml b/Cargo.toml index c851083..b3c7f7f 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -13,3 +13,9 @@ documentation = "https://docs.rs/embedded-storage" readme = "README.md" keywords = ["storage"] categories = ["embedded", "hardware-support", "no-std"] + +[dependencies] +defmt = { version = "0.3.8", optional = true } + +[features] +defmt-03 = ["dep:defmt"] diff --git a/src/nor_flash.rs b/src/nor_flash.rs index c20ddba..9e2dfad 100644 --- a/src/nor_flash.rs +++ b/src/nor_flash.rs @@ -26,6 +26,7 @@ pub trait ErrorType { /// NOR flash implementations must map their error to those generic error kinds through the /// [`NorFlashError`] trait. #[derive(Debug, Copy, Clone, Eq, PartialEq, Ord, PartialOrd, Hash)] +#[cfg_attr(feature = "defmt-03", derive(defmt::Format))] #[non_exhaustive] pub enum NorFlashErrorKind { /// The arguments are not properly aligned.