From e1a9ef00c69f325769843cf8d76b289eecd3ef6c Mon Sep 17 00:00:00 2001 From: Martin Toman <25009432+tinybeachthor@users.noreply.github.com> Date: Sun, 15 Dec 2024 19:36:03 -0600 Subject: [PATCH] serde-with-extras: impl Debug --- serde-with-extras/src/lib.rs | 13 ++++++++++++- 1 file changed, 12 insertions(+), 1 deletion(-) diff --git a/serde-with-extras/src/lib.rs b/serde-with-extras/src/lib.rs index f13d508..ecfd3ad 100644 --- a/serde-with-extras/src/lib.rs +++ b/serde-with-extras/src/lib.rs @@ -1,10 +1,12 @@ +use std::fmt::Debug; + use indexmap::IndexMap; use serde::{ser::SerializeTupleStruct, Serialize}; // re-export indexmap macro to construct attributes pub use indexmap::indexmap as extras; -pub const SERDE_EXTRAS_WELLKNOWN_NAME: &str = "__SERDE_EXTRAS_/_EXTRAS"; +pub const SERDE_EXTRAS_WELLKNOWN_NAME: &str = "__SERDE_EXTRAS__EXTRAS"; pub const EXTRAS_COMMENT_BEFORE: &str = "comment"; pub const EXTRAS_COMMENT_AFTER: &str = "comment-after"; @@ -33,6 +35,15 @@ impl Serialize for Extras { } } +impl Debug for Extras { + fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result { + f.debug_struct("Extras") + .field("inner", &self.inner) + .field("extras", &self.extras) + .finish() + } +} + impl Clone for Extras { fn clone(&self) -> Self { Self {