bevyengine / bevy

A refreshingly simple data-driven game engine built in Rust
https://bevyengine.org
Apache License 2.0
36.46k stars 3.6k forks source link

Allow resources to be inserted via tuple #16398

Open Wuketuke opened 1 week ago

Wuketuke commented 1 week ago

Whats the problem?

I think it's inconsistent that Systems and Plugins can be inserted via tuple like this, but not Resources:

app.add_plugins((
        DefaultPlugins,
        RapierPhysicsPlugin::<NoUserData>::default(),
        bevy_framepace::FramepacePlugin,
));

I mean sure, it's just a quality of life change, but it really annoys me haha

Implementation

If this proposal is green-lit, I want to try implementing it myself. I will probably do something similar to how Plugin tuples are handled. I will also update the documentation on App::insert_resource to reflect the change, but I dont know what kind of unit tests i should write, or what other documentation should change, so I'm happy to listen to suggestions.

BenjaminBrienen commented 1 week ago

I'm guessing this involves moving an impl into a macro and using variadics_please::all_tuples!.