diff --git a/src/with.rs b/src/with.rs index aa43f305..0585f1c0 100644 --- a/src/with.rs +++ b/src/with.rs @@ -81,7 +81,7 @@ pub mod singleton_map { use serde::ser::{ self, Serialize, SerializeMap, SerializeStructVariant, SerializeTupleVariant, Serializer, }; - use std::fmt; + use std::fmt::{self, Display}; #[allow(missing_docs)] pub fn serialize(value: &T, serializer: S) -> Result @@ -311,6 +311,13 @@ pub mod singleton_map { let mapping = Mapping::with_capacity(len); Ok(SerializeStructVariantAsSingletonMap { map, mapping }) } + + fn collect_str(self, value: &T) -> Result + where + T: ?Sized + Display, + { + self.delegate.collect_str(value) + } } struct SerializeTupleVariantAsSingletonMap {