From 3cf0007e4b13ae5859b19b9088af98d789ed5496 Mon Sep 17 00:00:00 2001 From: Liam Kinne Date: Fri, 26 Jul 2024 00:53:19 +1000 Subject: [PATCH 1/3] add optional defmt dependency --- Cargo.toml | 6 ++++++ 1 file changed, 6 insertions(+) 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"] From 4f37f21d86540824bb87ab1ffdda7707ba21280f Mon Sep 17 00:00:00 2001 From: Liam Kinne Date: Fri, 26 Jul 2024 00:53:43 +1000 Subject: [PATCH 2/3] add attribute on error kind type --- src/nor_flash.rs | 1 + 1 file changed, 1 insertion(+) 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. From 1a7eda04bc158bf897f773b4d55028553d3290e5 Mon Sep 17 00:00:00 2001 From: Liam Kinne Date: Fri, 26 Jul 2024 00:58:10 +1000 Subject: [PATCH 3/3] changelog entry --- CHANGELOG.md | 1 + 1 file changed, 1 insertion(+) 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