summaryrefslogtreecommitdiffstats
path: root/vendor/serde_derive/src/internals/attr.rs
diff options
context:
space:
mode:
Diffstat (limited to 'vendor/serde_derive/src/internals/attr.rs')
-rw-r--r--vendor/serde_derive/src/internals/attr.rs9
1 files changed, 9 insertions, 0 deletions
diff --git a/vendor/serde_derive/src/internals/attr.rs b/vendor/serde_derive/src/internals/attr.rs
index b0a7d08a2..bff82191b 100644
--- a/vendor/serde_derive/src/internals/attr.rs
+++ b/vendor/serde_derive/src/internals/attr.rs
@@ -740,6 +740,7 @@ pub struct Variant {
serialize_with: Option<syn::ExprPath>,
deserialize_with: Option<syn::ExprPath>,
borrow: Option<BorrowAttribute>,
+ untagged: bool,
}
struct BorrowAttribute {
@@ -762,6 +763,7 @@ impl Variant {
let mut serialize_with = Attr::none(cx, SERIALIZE_WITH);
let mut deserialize_with = Attr::none(cx, DESERIALIZE_WITH);
let mut borrow = Attr::none(cx, BORROW);
+ let mut untagged = BoolAttr::none(cx, UNTAGGED);
for attr in &variant.attrs {
if attr.path() != SERDE {
@@ -879,6 +881,8 @@ impl Variant {
cx.error_spanned_by(variant, msg);
}
}
+ } else if meta.path == UNTAGGED {
+ untagged.set_true(&meta.path);
} else {
let path = meta.path.to_token_stream().to_string().replace(' ', "");
return Err(
@@ -905,6 +909,7 @@ impl Variant {
serialize_with: serialize_with.get(),
deserialize_with: deserialize_with.get(),
borrow: borrow.get(),
+ untagged: untagged.get(),
}
}
@@ -956,6 +961,10 @@ impl Variant {
pub fn deserialize_with(&self) -> Option<&syn::ExprPath> {
self.deserialize_with.as_ref()
}
+
+ pub fn untagged(&self) -> bool {
+ self.untagged
+ }
}
/// Represents field attribute information