Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

refactor(bincode): extract hashmap and arraylist code to field configs #265

Merged
merged 2 commits into from
Sep 10, 2024

Conversation

dnut
Copy link
Contributor

@dnut dnut commented Sep 4, 2024

This takes all the custom logic from bincode.read and bincode.write that was written for hashmaps and arraylists, and it moves it to functions that return it as a FieldConfig in bincode/hashmap.zig and bincode/arraylist.zig. This hashmap field in FieldConfig is no longer needed, since this can be specified directly instead.

The getConfig function automatically applies the hashmap and arraylist FieldConfig for compatible types that don't have another config already. Long term there may be a better or more flexible way to include standard configs (maybe in Params?) but this was the easiest place to put it for now.

@InKryption InKryption self-requested a review September 4, 2024 23:39
@dnut dnut marked this pull request as ready for review September 5, 2024 01:02
@dnut dnut requested a review from 0xNineteen September 5, 2024 13:39
Copy link
Contributor

@yewman yewman left a comment

Choose a reason for hiding this comment

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

lgtm

Copy link
Contributor

@InKryption InKryption left a comment

Choose a reason for hiding this comment

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

No notes. Will leave it to you if you want to rename FieldConfig in this PR.

@dnut dnut merged commit b4e53c8 into main Sep 10, 2024
6 checks passed
@dnut
Copy link
Contributor Author

dnut commented Sep 10, 2024

No notes. Will leave it to you if you want to rename FieldConfig in this PR.

I decided to merge it as is, since I prefer iterating rapidly with smaller commits, once they are good to go. Also I wasn't sure what would be the best name. We can open another pr to address the rename.

@InKryption InKryption deleted the dnut/bincode-refactor branch September 10, 2024 21:49
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.

3 participants