Encourage serialize_entry

This commit is contained in:
David Tolnay 2017-04-19 14:56:52 -07:00
parent a8adac6b93
commit dfa6623a24
No known key found for this signature in database
GPG Key ID: F9BA143B95FF6D82

View File

@ -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<T: ?Sized>(&mut self, key: &T) -> Result<(), Self::Error>
where
T: Serialize;