File tree Expand file tree Collapse file tree 3 files changed +17
-0
lines changed
Expand file tree Collapse file tree 3 files changed +17
-0
lines changed Original file line number Diff line number Diff line change @@ -5,6 +5,12 @@ The `flatten` attribute inlines keys from a field into the parent struct.
55supported only within structs that have named fields, and the field to which it
66is applied must be a struct or map type.
77
8+ * Note:* ` flatten ` is not supported in combination with structs that use
9+ [ ` deny_unknown_fields ` ] . Neither the outer nor inner flattened struct should use
10+ that attribute.
11+
12+ [ `deny_unknown_fields` ] : container-attrs.md#deny_unknown_fields
13+
814The ` flatten ` attribute serves the following two common use cases:
915
1016### Factor out frequently grouped keys
Original file line number Diff line number Diff line change 3030 this attribute is not present, by default unknown fields are ignored for
3131 self-describing formats like JSON.
3232
33+ * Note:* this attribute is not supported in combination with [ ` flatten ` ] ,
34+ neither on the outer struct nor on the flattened field.
35+
36+ [ `flatten` ] : field-attrs.md#flatten
37+
3338- ##### ` #[serde(tag = "type")] ` {#tag}
3439
3540 Use the internally tagged enum representation for this enum, with the given
Original file line number Diff line number Diff line change 3838 with arbitrary string keys. The [ struct flattening] ( attr-flatten.md ) page
3939 provides some examples.
4040
41+ * Note:* this attribute is not supported in combination with structs that use
42+ [ ` deny_unknown_fields ` ] . Neither the outer nor inner flattened struct should
43+ use that attribute.
44+
45+ [ `deny_unknown_fields` ] : container-attrs.md#deny_unknown_fields
46+
4147- ##### ` #[serde(skip)] ` {#skip}
4248
4349 Skip this field: do not serialize or deserialize it.
You can’t perform that action at this time.
0 commit comments