bevyengine / bevyengine/bevy

Rich trait reflection

Open
#8,228 3 comments 0 reactions 0 assignees View on GitHub
A-Reflection C-Feature D-Complex
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

## What problem does this solve or what need does it fill?

I want to be able to dynamically generate things like custom RPC wrappers based on trait shape alone.

## What solution would you like?

I'd want `#[reflect_trait]` to behave a bit more like `#[derive(Reflect)]` and provide APIs to iterate over trait methods and parameters of said methods.

## What alternative(s) have you considered?

Using yet another macro to first convert trait into an enum where each method is a variant, and each parameter is a field of said variant, and _then_ applying `bevy_reflect`. But at that point I might as well do all the generation myself, which is what I'm doing today. I was hoping to replace it all with Bevy reflection.

Contributor guide

Open the contributing guide

Research direction

Start by comparing the requested #[reflect_trait] behavior with the existing #[derive(Reflect)] APIs. The work is complete when trait methods and their parameters can be iterated through reflection APIs, enabling generation from trait shape alone; the issue does not name files or tests to run.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Feature
Difficulty
5/5
Estimated time
Over a week
Activity status
Stale
Clarity
Needs clarification
Newbie friendliness
25/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.