Inform serializers about skipped fields.

Closes #960.
This commit is contained in:
Steven Fackler
2017-08-19 10:29:54 -07:00
committed by Steven Fackler
parent d4042872f5
commit 2fe9a860cd
2 changed files with 35 additions and 5 deletions
+12
View File
@@ -1727,6 +1727,12 @@ pub trait SerializeStruct {
where
T: Serialize;
/// Indicate that a struct field has been skipped.
fn skip_field(&mut self, key: &'static str) -> Result<(), Self::Error> {
let _ = key;
Ok(())
}
/// Finish serializing a struct.
fn end(self) -> Result<Self::Ok, Self::Error>;
}
@@ -1772,6 +1778,12 @@ pub trait SerializeStructVariant {
where
T: Serialize;
/// Indicate that a struct variant field has been skipped.
fn skip_field(&mut self, key: &'static str) -> Result<(), Self::Error> {
let _ = key;
Ok(())
}
/// Finish serializing a struct variant.
fn end(self) -> Result<Self::Ok, Self::Error>;
}