chaokunyang commented on code in PR #3092:
URL: https://github.com/apache/fory/pull/3092#discussion_r2647131028
##########
rust/fory-derive/src/util.rs:
##########
@@ -17,38 +17,73 @@
use syn::{Field, Fields, GenericArgument, PathArguments, Type, TypePath,
TypeTraitObject};
-pub fn sorted_fields(fields: &Fields) -> Vec<&Field> {
- let fields = fields.iter().collect::<Vec<&Field>>();
+/// Sorted field with its original index preserved.
+///
+/// For tuple structs, `original_index` is the field's position in the original
+/// struct definition (0, 1, 2, ...), which is used as the field name.
+#[derive(Clone, Copy)]
+pub struct SortedField<'a> {
Review Comment:
This name looks a little vargue to me. the sort is the semantics of a
collection, the element itself does not have this semantics.
How about just name as `StructField`?
--
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]