derive(Query) doesn't support query transformers
Nobody has claimed this yet.
- Dominant language
- Rust
- Stars
- 1.4k
- Forks
- 107
- Avg merge
- 2h
- Merged PRs (30d)
- 6
Description
Most hecs queries yield exactly their Query::Item with a dummy 'static lifetime. The derive(Query) macro takes advantage of this to make both the query type and its item literally the same struct. This fails for structs that contain e.g. With/Without, which transform query types without modifying the Query::Item type; e.g. With<&i32, &bool> has Item type &i32, but is a ZST.
The macro could be modified to generate a separate Item struct where each field's type is the source query's field's Item type. This might be confusing in cases where it's not required, although I suspect few users are directly naming query item types often. The macro could potentially support both modes of operation, but that might increase confusion, and could not be done automatically in any case.
Contributor guide
No contributing guide indexed for this repository
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
The issue names no files or tests. Start by locating the Rust derive(Query) macro entry point and any related tests, then compare generated query and Query::Item types for With and Without cases. Done means the macro has a clearly chosen behavior for transformed queries and that behavior is covered by tests.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- tooling
- Issue type
- Feature
- Difficulty
- 5/5
- Estimated time
- Over a week
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 38/100