Ralith / Ralith/hecs

hecs::Query should handle type parameters

Open
#359 2 comments 0 reactions 0 assignees View on GitHub

Nobody has claimed this yet.

enhancement good first issue help wanted
Dominant language
Rust
Stars
1.4k
Forks
107
Avg merge
2h
Merged PRs (30d)
6

Description

Basically I'd love this to work:

#[derive(hecs::Query)]
pub struct DrawSpriteQuery<'a, SpriteLike = Sprite> {
    pub transform: &'a Transform,
    pub sprite: &'a SpriteLike,
    pub shader_routine: &'a crate::gfx::ShaderRoutine,
    pub size: Option<&'a Size>,
}

I'll take a look in the macro to see how tough it would be, but I suspect not terribly difficult, but not sure!

Contributor guide

No contributing guide indexed for this repository

First steps

  1. Read the whole issue, then the project's contributing guide.
  2. Comment on the issue to say you are picking it up — it saves two people doing the same work.
  3. Fork the repository and make your change on a branch.
  4. Open a pull request that references the issue number.

Research direction

Start in the hecs::Query derive macro and trace how generic parameters on the query struct are parsed and represented. Use the issue's DrawSpriteQuery example as the starting case; done means an equivalent generic query with a default type parameter compiles and derives successfully.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
tooling
Issue type
Feature
Difficulty
3/5
Estimated time
1-2 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
45/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.