Skip to content

Commit 9295f5c

Browse files
committed
add optional defmt support for error types
add defmt as an optional dependent package
1 parent 6b88a3c commit 9295f5c

File tree

3 files changed

+7
-0
lines changed

3 files changed

+7
-0
lines changed

Cargo.toml

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,11 @@ optional = true
2323
default-features = false
2424
version = "1.0.100"
2525

26+
[dependencies.defmt]
27+
version = "0.3.0"
28+
default-features = false
29+
optional = true
30+
2631
[dev-dependencies]
2732
serde_derive = "1.0.100"
2833

src/de/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@ pub type Result<T> = core::result::Result<T, Error>;
1919
/// This type represents all possible errors that can occur when deserializing JSON data
2020
#[derive(Debug, PartialEq, Eq, Clone)]
2121
#[cfg_attr(not(feature = "custom-error-messages"), derive(Copy))]
22+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
2223
#[non_exhaustive]
2324
pub enum Error {
2425
/// EOF while parsing a list.

src/ser/mod.rs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ pub type Result<T> = ::core::result::Result<T, Error>;
2222

2323
/// This type represents all possible errors that can occur when serializing JSON data
2424
#[derive(Debug, PartialEq, Eq, Copy, Clone)]
25+
#[cfg_attr(feature = "defmt", derive(defmt::Format))]
2526
#[non_exhaustive]
2627
pub enum Error {
2728
/// Buffer is full

0 commit comments

Comments
 (0)