Skip to content
This repository has been archived by the owner on Mar 25, 2024. It is now read-only.

Commit

Permalink
Propagate collect_str in singleton_map Serializer
Browse files Browse the repository at this point in the history
  • Loading branch information
dtolnay committed Aug 13, 2022
1 parent ef6f2c5 commit c3b792e
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/with.rs
Expand Up @@ -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<T, S>(value: &T, serializer: S) -> Result<S::Ok, S::Error>
Expand Down Expand Up @@ -311,6 +311,13 @@ pub mod singleton_map {
let mapping = Mapping::with_capacity(len);
Ok(SerializeStructVariantAsSingletonMap { map, mapping })
}

fn collect_str<T>(self, value: &T) -> Result<Self::Ok, Self::Error>
where
T: ?Sized + Display,
{
self.delegate.collect_str(value)
}
}

struct SerializeTupleVariantAsSingletonMap<M> {
Expand Down

0 comments on commit c3b792e

Please sign in to comment.