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 opt-in generic traits for generated SoA types #73

Open
wants to merge 21 commits into
base: master
Choose a base branch
from

Conversation

mobiusklein
Copy link

This adds SoASlice, SoASliceMut, and SoAVec 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.

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.

1 participant