Document misuse of SerializeMap

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

View File

@ -1639,6 +1639,11 @@ pub trait SerializeMap {
T: Serialize; T: Serialize;
/// Serialize a map value. /// Serialize a map value.
///
/// # Panics
///
/// Calling `serialize_value` before `serialize_key` is incorrect and is
/// allowed to panic or produce bogus results.
fn serialize_value<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error> fn serialize_value<T: ?Sized>(&mut self, value: &T) -> Result<(), Self::Error>
where where
T: Serialize; T: Serialize;