bevy
bevy copied to clipboard
Remove second generic from `.add_before`, `.add_after`
Objective
// Currently:
builder.add_after::<FooPlugin, _>(BarPlugin);
// After this PR:
builder.add_after::<FooPlugin>(BarPlugin);
This removes some weirdness and better parallels the rest of the PluginGroupBuilder API.
Solution
Define a helper method type_id_of_val to use in .add_before and .add_after instead of TypeId::of::<T> (which requires the plugin type to be nameable, preventing impl Plugin from being used).
Testing
Ran cargo run -p ci lints successfully.
Migration Guide
Removed second generic from PluginGroupBuilder methods: add_before and add_after.
// Before:
DefaultPlugins
.build()
.add_before::<WindowPlugin, _>(FooPlugin)
.add_after::<WindowPlugin, _>(BarPlugin)
// After:
DefaultPlugins
.build()
.add_before::<WindowPlugin>(FooPlugin)
.add_after::<WindowPlugin>(BarPlugin)