Commit Graph

353 Commits

Author SHA1 Message Date
Mingun 9f9a1ea35e Do not use ? operator in the generated code where possible
This may slightly improve compilation time and costs nothing
2025-09-28 23:21:26 +05:00
David Tolnay 8047570160 Rename generate_body_in_place -> deserialize_in_place 2025-09-25 09:41:34 -07:00
David Tolnay b395215875 Rename all other generate_body -> deserialize 2025-09-25 09:41:33 -07:00
David Tolnay 20fc31c78a Rename identifier::generate_body -> deserialize_custom 2025-09-25 09:41:33 -07:00
David Tolnay dec153b8fa Adjust comments 2025-09-25 09:41:33 -07:00
David Tolnay c78f7d2e30 Rename Parameters::generics -> generics_with_de_lifetime 2025-09-25 09:41:33 -07:00
Mingun 88b6a9abf4 Rename functions and run cargo fmt 2025-09-21 20:40:21 +05:00
Mingun fa298c9df4 Move generator for identifiers to its own module
Cut-paste
2025-09-21 20:40:21 +05:00
Mingun c4a07ed4e8 Move body generator for unit structs to its own module
Cut-paste
2025-09-21 20:40:21 +05:00
Mingun c4986f10b9 Move body generator for tuple structs to its own module
Cut-paste
2025-09-21 20:40:21 +05:00
Mingun 2d607de146 Move body generator for structs to its own module
Cut-paste
2025-09-21 20:40:21 +05:00
Mingun 19956e6b8e Move body generator for enums to its own module
Cut-paste
2025-09-21 20:40:20 +05:00
Mingun ec13eb4ed6 Move body generator for untagged enums to its own module
Cut-paste
2025-09-21 20:40:20 +05:00
Mingun ae00c4acb7 Move body generator for internally tagged enums to its own module
Cut-paste
2025-09-21 20:40:20 +05:00
Mingun 85d0b9ccd8 Move body generator for externally tagged enums to its own module
Cut-paste
2025-09-21 20:40:20 +05:00
Mingun e60f62a289 Move body generator for adjacently tagged enums to its own module
Cut-paste
2025-09-21 20:40:20 +05:00
Mingun e04f0ba2de StructForm::InternallyTagged always instantiated with the same deserializer, so remove that parameter 2025-09-21 20:40:20 +05:00
Mingun c8184be238 StructForm::Untagged always instantiated with the same deserializer, so remove that parameter 2025-09-21 20:40:19 +05:00
Mingun 896d91f0bb TupleForm::Untagged always instantiated with the same deserializer, so remove that parameter 2025-09-21 20:40:19 +05:00
Mingun 915686d0ec deserialize_untagged_newtype_variant always called with the same deserializer, so remove that parameter 2025-09-21 20:40:19 +05:00
Mingun 3a682c951b deserialize_untagged_variant always called with the same deserializer, so remove that parameter 2025-09-21 20:40:19 +05:00
Mingun ca79f61d0f deserialize_internally_tagged_variant always called with the same deserializer, so remove that parameter 2025-09-21 20:40:19 +05:00
Mingun ddb7c4b30f Convert split_with_de_lifetime to method of Parameters 2025-09-21 15:39:11 +05:00
Mingun 4855fb467f Move code for injecting tagged variants to untagged generator to the place where the decision was made 2025-09-21 15:39:11 +05:00
Mingun 6dffc0b1c8 Remove one-line intermediate function 2025-09-21 15:39:11 +05:00
Mingun 15be2a600a Remove confusing call to deserialize_untagged_variant in deserialize_internally_tagged_variant
deserialize_untagged_variant in that place is called when deserialzie_with attribute is set.
In that case it performs special actions that is better to use explicitly in deserialize_untagged_variant
for readability
2025-09-21 15:39:11 +05:00
Mingun bfb020d975 Use variant name for field instead of field 2025-09-17 00:09:51 +05:00
Mingun 6805bba308 Inline variables that used only once 2025-09-17 00:09:14 +05:00
Mingun 2659b94a62 Create deserializer only when needed 2025-09-17 00:08:07 +05:00
Mingun c451415d9f Do not duplicate variant deserialization code 2025-09-17 00:07:00 +05:00
Mingun 553a9ff15f Document functions that are entry points for generating bodies of different deserialization forms 2025-09-17 00:05:53 +05:00
David Tolnay 97168d3a24 Touch up PR 2879 2025-09-15 20:38:57 -07:00
David Tolnay 373b11dda7 Merge pull request 2879 from rcrisanti/fix/silence-deprecation-warnings-derive 2025-09-15 20:26:40 -07:00
David Tolnay 69072f2423 Merge pull request 2931 from Mingun/unify-serde-access 2025-09-15 13:22:24 -07:00
Mingun b47f4dfa96 Unify access to the serde namespace
In other places `_serde` name is used to access the `serde` crate, so use it there
2025-09-16 00:36:12 +05:00
David Tolnay 957996f5fb Make all use of __private go through interpolation 2025-09-15 09:48:26 -07:00
David Tolnay 00b1b6b2b5 Move Content's Deserialize impl from serde_core to serde 2025-09-14 08:35:53 -07:00
David Tolnay f669f16127 Restore __deserialize_content optimization 2025-09-13 14:22:33 -07:00
Ryan Crisanti ae38b27aee add #[allow(deprecated)] to derive implementations
Allow deprecated in the `Serialize`/`Deserialize`
derive implementations. This allows you to
deprecate structs, enums, struct fields, or enum
variants and not get compiler warnings/errors
about use of deprecated thing. We only do this
if `#[deprecated]` or `#[allow(deprecated)]` exist
on the root object or the variants of the root
object (if it is an enum).

Resolves #2195
2025-05-30 15:01:14 -04:00
David Tolnay 9497463718 Mark all generated trait impls as #[automatically_derived] 2024-12-10 17:57:05 -08:00
Tamme Dittrich e9c399c822 Mark generated impl de::Visitor blocks as #[automatically_derived]
This hides the generated visitors and field visitors from code
coverage.
2024-12-05 17:26:13 +01:00
David Tolnay c59e876bb3 Produce a separate warning for every colliding name 2024-11-10 23:23:09 -08:00
David Tolnay 373edcd055 Keep track of a span for alias strings 2024-11-10 23:08:40 -08:00
David Tolnay b60e4092ec Hygiene for macro-generated newtype struct deserialization with 'with' attr 2024-10-22 11:10:40 -07:00
David Tolnay 1e36ef551d Fix hygiene of macro-generated local variable accesses in serde(with) wrappers 2024-10-22 09:38:06 -07:00
David Tolnay 09f6d9361d Collect field ident and aliases into a struct 2024-10-21 23:16:05 -07:00
David Tolnay c6a5be7f6a Rename variant_names_idents -> variant_idents_aliases 2024-10-21 22:56:07 -07:00
David Tolnay 0a06af8d21 Rename field_names_idents -> field_idents_aliases 2024-10-21 22:48:02 -07:00
David Tolnay 3393ad6760 Make most of prepare_enum_variant_enum independent of variant_names_idents item type 2024-10-21 22:47:42 -07:00
Oli Scherer 3415619bfd Merge pull request #2566 from Mingun/variant-aliases
Show variant aliases in error message
2024-10-21 21:40:57 +02:00