feat(codegen): Detect repeated struct field when deserializing

This commit is contained in:
David Tolnay
2016-05-10 09:52:51 -07:00
parent 7aa0b6ce27
commit eeb4efc19c
4 changed files with 49 additions and 0 deletions
+6
View File
@@ -46,6 +46,12 @@ pub trait Error: Sized + error::Error {
fn missing_field(field: &'static str) -> Self {
Error::custom(format!("Missing field `{}`", field))
}
/// Raised when a `Deserialize` struct type received more than one of the
/// same struct field.
fn duplicate_field(field: &'static str) -> Self {
Error::custom(format!("Duplicate field `{}`", field))
}
}
/// `Type` represents all the primitive types that can be deserialized. This is used by