Trait PluginGroup

Source
pub trait PluginGroup: Sized {
    // Required method
    fn build(self) -> PluginGroupBuilder;

    // Provided methods
    fn name() -> String { ... }
    fn set<T>(self, plugin: T) -> PluginGroupBuilder
       where T: Plugin { ... }
}
Expand description

Combines multiple Plugins into a single unit.

If you want an easier, but slightly more restrictive, method of implementing this trait, you may be interested in the plugin_group! macro.

Required Methods§

Source

fn build(self) -> PluginGroupBuilder

Configures the Plugins that are to be added.

Provided Methods§

Source

fn name() -> String

Configures a name for the PluginGroup which is primarily used for debugging.

Source

fn set<T>(self, plugin: T) -> PluginGroupBuilder
where T: Plugin,

Sets the value of the given Plugin, if it exists

Examples found in repository?
tests/3d/no_prepass.rs (lines 7-10)
5fn main() {
6    App::new()
7        .add_plugins(DefaultPlugins.set(PbrPlugin {
8            prepass_enabled: false,
9            ..default()
10        }))
11        .run();
12}
More examples
Hide additional examples
examples/app/thread_pool_resources.rs (lines 8-10)
6fn main() {
7    App::new()
8        .add_plugins(DefaultPlugins.set(TaskPoolPlugin {
9            task_pool_options: TaskPoolOptions::with_num_threads(4),
10        }))
11        .run();
12}
examples/app/log_layers.rs (lines 41-45)
39fn main() {
40    App::new()
41        .add_plugins(DefaultPlugins.set(bevy::log::LogPlugin {
42            custom_layer,
43
44            ..default()
45        }))
46        .add_systems(Update, log_system)
47        .run();
48}
examples/2d/sprite_sheet.rs (line 8)
6fn main() {
7    App::new()
8        .add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest())) // prevents blurry sprites
9        .add_systems(Startup, setup)
10        .add_systems(Update, animate_sprite)
11        .run();
12}
examples/picking/sprite_picking.rs (line 9)
7fn main() {
8    App::new()
9        .add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest()))
10        .add_systems(Startup, (setup, setup_atlas))
11        .add_systems(Update, (move_sprite, animate_sprite))
12        .run();
13}
examples/2d/pixel_grid_snap.rs (line 31)
29fn main() {
30    App::new()
31        .add_plugins(DefaultPlugins.set(ImagePlugin::default_nearest()))
32        .add_systems(Startup, (setup_camera, setup_sprite, setup_mesh))
33        .add_systems(Update, (rotate, fit_canvas))
34        .run();
35}

Dyn Compatibility§

This trait is not dyn compatible.

In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.

Implementors§