diff --git a/crates/bevy_app/src/app_builder.rs b/crates/bevy_app/src/app_builder.rs index f198ce1021fad..3a3965b449eb1 100644 --- a/crates/bevy_app/src/app_builder.rs +++ b/crates/bevy_app/src/app_builder.rs @@ -1,7 +1,7 @@ use crate::{ app::{App, AppExit}, event::Events, - plugin::{load_plugin, AppPlugin}, + plugin::{load_plugin, Plugin}, stage, startup_stage, }; use bevy_ecs::{FromResources, IntoQuerySystem, Resources, System, World}; @@ -228,7 +228,7 @@ impl AppBuilder { pub fn add_plugin(&mut self, plugin: T) -> &mut Self where - T: AppPlugin, + T: Plugin, { log::debug!("added plugin: {}", plugin.name()); plugin.build(self); diff --git a/crates/bevy_app/src/lib.rs b/crates/bevy_app/src/lib.rs index 57d3eeceb24f7..871b172c45efb 100644 --- a/crates/bevy_app/src/lib.rs +++ b/crates/bevy_app/src/lib.rs @@ -9,7 +9,7 @@ mod startup_stage; pub use app::*; pub use app_builder::*; -pub use bevy_derive::DynamicAppPlugin; +pub use bevy_derive::DynamicPlugin; pub use event::*; pub use plugin::*; pub use schedule_runner::*; @@ -20,7 +20,7 @@ pub mod prelude { app::App, app_builder::AppBuilder, event::{EventReader, Events}, - plugin::AppPlugin, - stage, DynamicAppPlugin, + plugin::Plugin, + stage, DynamicPlugin, }; } diff --git a/crates/bevy_app/src/plugin.rs b/crates/bevy_app/src/plugin.rs index e0d130ca6fd39..cee7effbd0816 100644 --- a/crates/bevy_app/src/plugin.rs +++ b/crates/bevy_app/src/plugin.rs @@ -2,20 +2,20 @@ use crate::AppBuilder; use libloading::{Library, Symbol}; use std::any::Any; -pub trait AppPlugin: Any + Send + Sync { +pub trait Plugin: Any + Send + Sync { fn build(&self, app: &mut AppBuilder); fn name(&self) -> &str { std::any::type_name::() } } -pub type CreateAppPlugin = unsafe fn() -> *mut dyn AppPlugin; +pub type CreatePlugin = unsafe fn() -> *mut dyn Plugin; -pub fn load_plugin(path: &str) -> (Library, Box) { +pub fn load_plugin(path: &str) -> (Library, Box) { let lib = Library::new(path).unwrap(); unsafe { - let func: Symbol = lib.get(b"_create_plugin").unwrap(); + let func: Symbol = lib.get(b"_create_plugin").unwrap(); let plugin = Box::from_raw(func()); (lib, plugin) } diff --git a/crates/bevy_app/src/schedule_runner.rs b/crates/bevy_app/src/schedule_runner.rs index e89cd31654b26..d9f456906792c 100644 --- a/crates/bevy_app/src/schedule_runner.rs +++ b/crates/bevy_app/src/schedule_runner.rs @@ -2,7 +2,7 @@ use super::{App, AppBuilder}; use crate::{ app::AppExit, event::{EventReader, Events}, - plugin::AppPlugin, + plugin::Plugin, }; use std::{thread, time::Duration}; @@ -39,7 +39,7 @@ impl ScheduleRunnerPlugin { } } -impl AppPlugin for ScheduleRunnerPlugin { +impl Plugin for ScheduleRunnerPlugin { fn build(&self, app: &mut AppBuilder) { let run_mode = self.run_mode; app.set_runner(move |mut app: App| { diff --git a/crates/bevy_asset/src/lib.rs b/crates/bevy_asset/src/lib.rs index 81fcf9dcad2a8..fe742af678f4a 100644 --- a/crates/bevy_asset/src/lib.rs +++ b/crates/bevy_asset/src/lib.rs @@ -21,14 +21,14 @@ pub mod prelude { pub use crate::{AddAsset, AssetEvent, AssetServer, Assets, Handle}; } -use bevy_app::{prelude::AppPlugin, AppBuilder}; +use bevy_app::{prelude::Plugin, AppBuilder}; use bevy_ecs::IntoQuerySystem; use bevy_type_registry::RegisterType; #[derive(Default)] pub struct AssetPlugin; -impl AppPlugin for AssetPlugin { +impl Plugin for AssetPlugin { fn build(&self, app: &mut AppBuilder) { app.add_stage_before(bevy_app::stage::PRE_UPDATE, stage::LOAD_ASSETS) .add_stage_after(bevy_app::stage::POST_UPDATE, stage::ASSET_EVENTS) diff --git a/crates/bevy_audio/src/lib.rs b/crates/bevy_audio/src/lib.rs index 4a83272bd223e..40fc7979d3ff8 100644 --- a/crates/bevy_audio/src/lib.rs +++ b/crates/bevy_audio/src/lib.rs @@ -15,7 +15,7 @@ use bevy_ecs::IntoQuerySystem; #[derive(Default)] pub struct AudioPlugin; -impl AppPlugin for AudioPlugin { +impl Plugin for AudioPlugin { fn build(&self, app: &mut AppBuilder) { app.init_resource::() .add_asset::() diff --git a/crates/bevy_core/src/lib.rs b/crates/bevy_core/src/lib.rs index 2a2c76c591a39..9e9121e02d295 100644 --- a/crates/bevy_core/src/lib.rs +++ b/crates/bevy_core/src/lib.rs @@ -20,7 +20,7 @@ use bevy_type_registry::RegisterType; #[derive(Default)] pub struct CorePlugin; -impl AppPlugin for CorePlugin { +impl Plugin for CorePlugin { fn build(&self, app: &mut AppBuilder) { app.init_resource::