5ee2fc0562
Before this change, flattening anything after a flattened map was nonsensical because the later flattened field would always observe no input fields. #[derive(Deserialize)] struct S { #[serde(flatten)] map: Map<K, V>, #[serde(flatten)] other: Other, // always empty } This change makes a flattened map not consume any of the input fields, leaving them available to later flattened fields in the same struct. The new behavior is useful when two flattened fields that both use deserialize_map care about disjoint subsets of the fields in the input. #[derive(Deserialize)] struct S { // Looks at fields with a "player1_" prefix. #[serde(flatten, with = "prefix_player1")] player1: Player, // Looks at fields with a "player2_" prefix. #[serde(flatten, with = "prefix_player2")] player2: Player, } |
||
---|---|---|
.. | ||
bytes | ||
compile-fail | ||
macros | ||
run-pass | ||
compiletest.rs | ||
test_annotations.rs | ||
test_borrow.rs | ||
test_de.rs | ||
test_gen.rs | ||
test_identifier.rs | ||
test_macros.rs | ||
test_remote.rs | ||
test_roundtrip.rs | ||
test_ser.rs | ||
test_value.rs |