urlyy opened a new pull request, #2630: URL: https://github.com/apache/fory/pull/2630
## What does this PR do? 1. Sort fields both at compile-time and runtime.Add a `fn get_sorted_field_names(fory: &Fory) -> Vec<String>;` to get T::sorted_field_names, and use these sorted_names to guide read/write order at runtime. Sort `primitive/nullable_ primitive/container` fields at compile-time, and classify `enum/struct` and sort `final/other` fields at runtime. And it will `conditionally render code`(when a field_group is empty, will not render). What's more, `get_sorted_field_names()` caches results based on `TypeId`. 2. Feat Enum. Fulfill the code in `derive_enum.rs` and add unit test with java. 3. Fix read/write type_info. The `serialize()` function only deals with the `is_field` parameter and the `ref_flag`. Reading and writing `type_id` and `meta_share` happens inside `read()` and `write()`. What these functions do depends on the type `T` and whether `is_field` is set. For structs, no matter if they’re the outer object, a field, or an element in a container, they always write `type_id` and `meta_index`. For other types(include container and enums), `type_id` is only read or written when they are the outer object. If they show up as a field, `type_id` is skipped. 4. Fix type_meta en/decode. In previous versions, the execution order for taking the absolute value of `global_hash` was incorrect. And Some calls to `var_int()` have been changed to `var_uint()`. 5. Add some unit tests. ## Does this PR introduce any user-facing change? - [ ] Does this PR introduce any public API change? - [ ] Does this PR introduce any binary protocol compatibility change? -- This is an automated message from the Apache Git Service. To respond to the message, please log on to GitHub and use the URL above to go to the specific comment. To unsubscribe, e-mail: [email protected] For queries about this service, please contact Infrastructure at: [email protected] --------------------------------------------------------------------- To unsubscribe, e-mail: [email protected] For additional commands, e-mail: [email protected]
