bevyengine / bevyengine/bevy

bevy_reflect: Add reflection support for async fn

Open
#18,053 0 comments 0 reactions 0 assignees View on GitHub
A-Reflection C-Feature S-Needs-Design X-Uncontroversial
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?

Support function reflection for `async fn(...) -> T` in `bevy_reflect`

## What solution would you like?

it should work as usual non-async functions, where the args and the return types are `Reflect`.

## What alternative(s) have you considered?

None really, but I've tried to use `fn(...) -> MyFuture` where `MyFuture` implements `IntoFuture`/`Future` + `Reflect`. However this was so limited as I can't use `await` inside my function + if i wanted to do so I would return a boxed future object which is not the best.

## Additional context

Adding support for async functions reflection could be useful in some cases, but the question would be how we would call it _dynamically_? could be also useful to add some metadata about the `asyncness` of the function for example.

Contributor guide

Open the contributing guide

Research direction

Start by reading the existing function-reflection support in bevy_reflect and identify how reflected arguments and return types are handled. The issue leaves dynamic invocation and asyncness metadata unresolved; done would require a decided way to reflect and dynamically call async functions whose arguments and return types implement Reflect.

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
Needs clarification
Newbie friendliness
28/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.