Improve error messages related to transparent

This commit is contained in:
David Tolnay
2018-05-20 15:09:51 -07:00
parent 1335f85213
commit ac1b25e91d
6 changed files with 74 additions and 71 deletions
+10
View File
@@ -776,6 +776,7 @@ pub struct Field {
borrowed_lifetimes: BTreeSet<syn::Lifetime>,
getter: Option<syn::ExprPath>,
flatten: bool,
transparent: bool,
}
/// Represents the default to use for a field when deserializing.
@@ -1077,6 +1078,7 @@ impl Field {
borrowed_lifetimes: borrowed_lifetimes,
getter: getter.get(),
flatten: flatten.get(),
transparent: false,
}
}
@@ -1136,6 +1138,14 @@ impl Field {
pub fn flatten(&self) -> bool {
self.flatten
}
pub fn transparent(&self) -> bool {
self.transparent
}
pub fn mark_transparent(&mut self) {
self.transparent = true;
}
}
type SerAndDe<T> = (Option<T>, Option<T>);