rust-lang / rust-lang/portable-simd
Better ergonomics for working with vector of pointers to structs/enums
Open
Nobody has claimed this yet.
C-feature-request
- Dominant language
- Rust
- Stars
- 1.1k
- Forks
- 108
- Avg merge
- 22h 53m
- Merged PRs (30d)
- 3
Description
I think there should be some support for working with vectors of pointers to structs. Specifically I think the following features would be helpful:
- Having a way to pass from pointers to a struct/enum to pointers to a member. Today this can be done by casting to
const* u8, adding theoffset_of!and casting back, but I think a dedicated macro for this would be cleaner. Also theenumpart needs a nightly feature to work (offset_of_enum) - Having a way to "match" a vector of enums, i.e., given a variant getting a mask encoding which lanes point to instances of this variant. Today there is no general way of doing it (you can try doing the same trick to get the discriminant, but there's no way to know what is the relevant discriminant value for each variant, and it becomes even trickier if the discriminant is optimized in some way (e.g. the niche optimization))
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by examining the issue's proposed pointer-to-member workflow using const* u8, offset_of!, and offset_of_enum, then compare it with existing portable-SIMD vector and enum facilities. Before implementation, define the supported APIs for member access and variant matching, along with tests that establish the expected masks and behavior.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- performance
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Needs clarification
- Newbie friendliness
- 25/100