Ignore Default requirements when using unit structs in required components
- 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?
In order to add a unit struct to a components required components you need to implement Default on it, which is unneeded as unit structs only have one state.
## What solution would you like?
Ignore the Default requirements for unit structs
```rust
#[derive(Component)]
pub struct Player;
#[derive(Component)]
#[require(Player)]
pub struct Character {
health: u32,
}
```
## What alternative(s) have you considered?
Deriving Default on all unit components which is a bit tedious.
Contributor guide
Research direction
Start by locating the Rust implementation of the Component derive and the #[require] handling, then inspect how required components currently obtain Default. Use the unit-struct example as the acceptance case: a unit component should work without deriving Default, while the Character example should still compile and initialize its required component.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- rust
- Domain
- game-dev
- Issue type
- Feature
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Mostly clear
- Newbie friendliness
- 35/100