Less horrible logic for missing fields that unconditionally return error

This commit is contained in:
David Tolnay
2018-05-06 22:20:07 -07:00
parent 697234517d
commit 6475e73b05
2 changed files with 13 additions and 7 deletions
+10
View File
@@ -738,6 +738,16 @@ pub enum Default {
Path(syn::ExprPath),
}
impl Default {
#[cfg(feature = "deserialize_in_place")]
pub fn is_none(&self) -> bool {
match *self {
Default::None => true,
Default::Default | Default::Path(_) => false,
}
}
}
impl Field {
/// Extract out the `#[serde(...)]` attributes from a struct field.
pub fn from_ast(