Skip to content

refactor: Improve code structure of the derive code - #560

Merged
Kriskras99 merged 2 commits into
mainfrom
refactor/derive
Jun 23, 2026
Merged

Kriskras99 merged 2 commits into
mainfrom
refactor/derive

Conversation

@Kriskras99

Copy link
Copy Markdown
Contributor

This also changes the implementation of utils::field_aliases to remove the unnecessary try_from.

Comment thread avro_derive/src/fields.rs Resolved
Comment thread avro_derive/src/fields.rs Outdated
}
}

pub fn get_field_field_default_expr(

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
pub fn get_field_field_default_expr(
pub(crate) fn get_field_field_default_expr(

Why there are two field in the name ?

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It's the naming convention used by the other functions get_field + trait function name + expr. But I agree the naming is shit, I'll think up something better.

Making it pub(crate) has no effect as it is a private module.

Copy link
Copy Markdown
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I've renamed them to match the type_to_..._expr functions below

Comment thread avro_derive/src/fields.rs Resolved
Comment thread avro_derive/src/structs.rs Resolved
Comment thread avro_derive/src/utils.rs Resolved
Comment thread avro_derive/src/fields.rs Resolved
Comment thread avro_derive/src/utils.rs Resolved
This also changes the implementation of `utils::field_aliases` to remove
the unnecessary `try_from`.
@Kriskras99
Kriskras99 merged commit 77531c6 into main Jun 23, 2026
13 checks passed
@Kriskras99
Kriskras99 deleted the refactor/derive branch June 23, 2026 19:07
@Kriskras99 Kriskras99 mentioned this pull request Jun 28, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants