Skip to content

Commit 40f5cf1

Browse files
geieredgarcart
andauthored
Allow tuples and single plugins in add_plugins, deprecate add_plugin (#8097)
# Objective - Better consistency with `add_systems`. - Deprecating `add_plugin` in favor of a more powerful `add_plugins`. - Allow passing `Plugin` to `add_plugins`. - Allow passing tuples to `add_plugins`. ## Solution - `App::add_plugins` now takes an `impl Plugins` parameter. - `App::add_plugin` is deprecated. - `Plugins` is a new sealed trait that is only implemented for `Plugin`, `PluginGroup` and tuples over `Plugins`. - All examples, benchmarks and tests are changed to use `add_plugins`, using tuples where appropriate. --- ## Changelog ### Changed - `App::add_plugins` now accepts all types that implement `Plugins`, which is implemented for: - Types that implement `Plugin`. - Types that implement `PluginGroup`. - Tuples (up to 16 elements) over types that implement `Plugins`. - Deprecated `App::add_plugin` in favor of `App::add_plugins`. ## Migration Guide - Replace `app.add_plugin(plugin)` calls with `app.add_plugins(plugin)`. --------- Co-authored-by: Carter Anderson <[email protected]>
1 parent db4bfc9 commit 40f5cf1

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/lib.rs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -99,10 +99,10 @@ impl Plugin for WinitPlugin {
9999
),
100100
);
101101

102-
app.add_plugin(AccessibilityPlugin);
102+
app.add_plugins(AccessibilityPlugin);
103103

104104
#[cfg(target_arch = "wasm32")]
105-
app.add_plugin(CanvasParentResizePlugin);
105+
app.add_plugins(CanvasParentResizePlugin);
106106

107107
#[cfg(not(target_arch = "wasm32"))]
108108
let mut create_window_system_state: SystemState<(

0 commit comments

Comments
 (0)