Skip to main content

PluginGroup

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/asset/web_asset.rs (lines 10-12)
8fn main() {
9    App::new()
10        .add_plugins(DefaultPlugins.set(WebAssetPlugin {
11            silence_startup_warning: true,
12        }))
13        .add_systems(Startup, setup)
14        .run();
15}
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/app/log_layers.rs (lines 56-61)
54fn main() {
55    App::new()
56        .add_plugins(DefaultPlugins.set(bevy::log::LogPlugin {
57            custom_layer,
58            fmt_layer,
59
60            ..default()
61        }))
62        .add_systems(Update, log_system)
63        .run();
64}
examples/app/no_renderer.rs (lines 15-22)
12fn main() {
13    App::new()
14        .add_plugins(
15            DefaultPlugins.set(RenderPlugin {
16                render_creation: WgpuSettings {
17                    backends: None,
18                    ..default()
19                }
20                .into(),
21                ..default()
22            }),
23        )
24        .run();
25}

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§