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

Add SerializeBits/DeserializeBits derive macros #84

Merged
merged 11 commits into from
May 17, 2024

Conversation

widberg
Copy link
Contributor

@widberg widberg commented Oct 16, 2023

Draft pr for issue #74

@widberg widberg marked this pull request as ready for review March 27, 2024 23:09
Copy link
Owner

@hecatia-elegua hecatia-elegua left a comment

Choose a reason for hiding this comment

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

Thank you!
I will not hold this back a lot, but does internal deserialize code always look this complicated? 🤣
It seems like you can do something better with the deserialize_field_parts inlined and maybe inverting the logic a bit.
You can try, but it would be enough to add tests for arb ints before merging, see comment.

}
}

fn deserialize_field_parts(
Copy link
Owner

Choose a reason for hiding this comment

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

I don't like this.

field_visit_map_match,
field_visit_map_check,
mut field_expecting,
): (Vec<_>, Vec<_>, Vec<_>, Vec<_>, Vec<_>, Vec<_>, Vec<_>, Vec<_>) = match struct_data.fields {
Copy link
Owner

Choose a reason for hiding this comment

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

and this.

tests/serde.rs Outdated
Copy link
Owner

Choose a reason for hiding this comment

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

These tests are nice, but we have to have one testing an arbitrary integer field ser-de 😄

@widberg
Copy link
Contributor Author

widberg commented Apr 12, 2024

Let me know if those tests look any better or if you have more cases you want me to add. I'll work on cleaning up the logic you pointed out before this gets merged. ime internal deserialize code is usually pretty complicated just because of how serde requires it to be implemented; if there is a better way I'd be happy to do it like that instead.

@hecatia-elegua
Copy link
Owner

(running CI to run tests, feel free to clean up still)

@widberg
Copy link
Contributor Author

widberg commented Apr 24, 2024

I took a stab at cleaning up those ugly tuple types and couldn't come up with anything that didn't look uglier to me :(. That being said I wouldn't be offended if you or someone else took a hacksaw to my stuff. I don't have anything else to offer for this PR.

Copy link
Owner

@hecatia-elegua hecatia-elegua left a comment

Choose a reason for hiding this comment

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

Sorry, I was away again. The nightly test fail is not important rn, but your new tests are not actually running, I didn't realize this earlier. We can just change the workflow file to do cargo test --workspace --features serde.
Again something I could do myself, but I dislike when others fiddle around in my changeset, so I don't do so in others changesets either.

@hecatia-elegua hecatia-elegua merged commit a338e82 into hecatia-elegua:main May 17, 2024
1 of 2 checks passed
@hecatia-elegua
Copy link
Owner

We got it :)
Now I'll need to figure out how to handle the nightly stuff.

Thank you again.

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