bevyengine / bevyengine/bevy

Add a #[param_set] macro

Open
#4,885 2 comments 6 reactions 0 assignees View on GitHub
A-ECS C-Feature
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 22h
Merged PRs (30d)
161

Description

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

A paramset macro would allow for ergonomic use of a large amount of custom SystemParam derives.

## What solution would you like?

```rust
#[param_set]
struct MyParamSet<'w, 's> {
params_1: SomeCustomSystemParam<'w, 's>,
params_2: SomeOtherSystemParam<'w, 's>,
}
```
that expands to something like
```rust
#[derive(SystemParam)]
struct MyParamSet {
// either a custom impl of `ParamSet` internals, or a desugaring into using `ParamSet` itself
}

impl<'w, 's> MyParamSet<'w, 's> {
fn params_1(&mut self) -> SomeCustomSystemParam<'_, '_>;
fn params_2(&mut self) -> SomeOtherSystemParam<'_, '_>;
}
```
## What alternative(s) have you considered?

Do not add this, people continue using `ParamSet` and run into ergonomic issues when working with larger param sets.

## Additional context
Initial discussion: https://discord.com/channels/691052431525675048/749335865876021248/981283440051777586

Contributor guide

Open the contributing guide

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.