diff --git a/serde/src/ser/mod.rs b/serde/src/ser/mod.rs index 6472909b..bf92563f 100644 --- a/serde/src/ser/mod.rs +++ b/serde/src/ser/mod.rs @@ -1634,6 +1634,11 @@ pub trait SerializeMap { type Error: Error; /// Serialize a map key. + /// + /// If possible, `Serialize` implementations are encouraged to use + /// `serialize_entry` instead as it may be implemented more efficiently in + /// some formats compared to a pair of calls to `serialize_key` and + /// `serialize_value`. fn serialize_key(&mut self, key: &T) -> Result<(), Self::Error> where T: Serialize;