bevyengine / bevyengine/bevy

Refactor `ResMut` and `NonSendMut` into wrappers of `Mut`

Open
#5,439 2 comments 0 reactions 0 assignees View on GitHub
A-ECS C-Code-Quality
Dominant language
Rust
Stars
48.2k
Forks
4.8k
Avg merge
3d 16h
Merged PRs (30d)
171

Description

This is a follow up to the [Discord discussion](https://discord.com/channels/691052431525675048/742569353878437978/1000518580594552992) about converting `ResMut` and `NonSendMut` into `Mut`, which in itself is achieved by #5438.

During the discussion, @DJMcNab pointed that since `ResMut` and `NonSendMut` have the exact same fields and same implementation as `Mut`, and only differ by their system param role, we could have them be strict wrappers of `Mut` instead of duplicating the fields and the implementations using macros. Something like:

```rust
pub struct ResMut(Mut);
pub struct NonSendMut(Mut);
```

This incidentally makes #5438 trivial.

Contributor guide

Open the contributing guide

Research direction

Start by reviewing the implementation of Mut, ResMut, and NonSendMut, along with the related change in issue #5438. Confirm how their fields and implementations are currently shared or duplicated, then verify that ResMut and NonSendMut become strict wrappers without changing their system-parameter roles or the behavior targeted by #5438.

Written by the indexing model from the issue text.

Assessment

Tech stack
rust
Domain
game-dev
Issue type
Refactor
Difficulty
4/5
Estimated time
3-5 days
Activity status
Stale
Clarity
Mostly clear
Newbie friendliness
35/100

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.