-
-
Notifications
You must be signed in to change notification settings - Fork 3.6k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Allow tuples and single plugins in add_plugins
, deprecate add_plugin
#8097
Conversation
ea208f9
to
c100d07
Compare
I've rebased this on main after #8079 was merged. I think this is ready for final reviews. |
add_plugins
, remove add_plugin
add_plugins
, deprecate add_plugin
To be consistent with #8079, I've changed this PR to only deprecate |
@geieredgar I like this PR's direction and I think we should make a call for 0.11. Can you rebase please? |
@alice-i-cecile I've rebased the PR. I also renamed the marker types and type parameters to be more consistent with similar traits like |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Well-made, and I think there's an argument for this. I don't have strong feelings either way on the change, so I'll defer to Cart et al on that.
I’m lightly opposed to this sort of thing for the same reasons I brought up in the PR for To reiterate:
|
One notable difference. Unlike resources, which do not currently have a plural version of the api and are generally thought of as a classic rust "key->value" API, Plugins already have the From my perspective the only controversial part of this is deprecating
I'll argue that most of the instances of "merged plugin adds" in this PR do have "groupings" of functionality. They are either called from inside of a parent Plugin, where the "grouping scope" is "Plugins used by the Parent Plugin to accomplish its goal". Or they are called in the context of a In cases where logical groups are desired, devs can still make multiple calls. Or if they prefer, they can use comments within the tuple to denote organizational sections. |
I'll leave this open for a day-ish to leave room for a bit more discussion. But I'm inclined to merge. |
I am in favor. I agree with cart. I was initially in favor for resources too, but I changed my mind on that one, because resources are consistently treated as singular standalone items semantically everywhere in bevy. Their intention is to be standalone pieces of data. Like cart said, the "key->value" feel. But plugins are not. We clearly need a way to add multiple plugins at once ( Also reducing the number of variants (unique methods) in the App API is a good thing. Having both |
I was talking about the tuple itself having some observable difference from multiple builder calls (like the traits implemented on system tuples). I hadn’t considered we already need this in the form of PluginGroup or other abstractions, and this obviously feels better than that so I’m in favor now. |
Objective
add_systems
.add_plugin
in favor of a more powerfuladd_plugins
.Plugin
toadd_plugins
.add_plugins
.Solution
App::add_plugins
now takes animpl Plugins
parameter.App::add_plugin
is deprecated.Plugins
is a new sealed trait that is only implemented forPlugin
,PluginGroup
and tuples overPlugins
.add_plugins
, using tuples where appropriate.Changelog
Changed
App::add_plugins
now accepts all types that implementPlugins
, which is implemented for:Plugin
.PluginGroup
.Plugins
.App::add_plugin
in favor ofApp::add_plugins
.Migration Guide
app.add_plugin(plugin)
calls withapp.add_plugins(plugin)
.