-
Notifications
You must be signed in to change notification settings - Fork 29
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 opt-in generic traits for generated SoA types #73
Open
mobiusklein
wants to merge
21
commits into
lumol-org:master
Choose a base branch
from
mobiusklein:master
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This adds
SoASlice
,SoASliceMut
, andSoAVec
traits and adds a new attribute#[generate_traits]
to automatically implement them on the generated types.Because I saw a specific Rust version pinned in the test suite that predated the stabilization of GATs, I had to feature-gate the traits on both the internal and public-facing crates. Unfortunately, the mixed root + internal crates workspace setup didn't seem to support traits on the crate at the repository root, so I had to re-structure repository to a uniform workspace. The traits still exist when the
generic_traits
feature is disabled, but they have no methods or associated types so the source code is still Rust 1.63 compatible.Hopefully, that means there are no breaking changes unless the feature is enabled.
I couldn't implement a clean "root trait" that tied all of the different types and interfaces together. I could not find a way to do so while not generating a type system query overflow or cycle or cease to function as lifetime dependencies tangled. I'm still not satisfied with the API, but I've convinced myself that as the language stands today I can't make it any better.