mirror of
https://github.com/bevyengine/bevy
synced 2025-01-12 13:18:55 +00:00
This is extracted out of eb8f973646476b4a4926ba644a77e2b3a5772159 and includes some additional changes to remove all references to AppBuilder and fix examples that still used App::build() instead of App::new(). In addition I didn't extract the sub app feature as it isn't ready yet. You can use `git diff --diff-filter=M eb8f973646476b4a4926ba644a77e2b3a5772159` to find all differences in this PR. The `--diff-filtered=M` filters all files added in the original commit but not in this commit away. Co-Authored-By: Carter Anderson <mcanders1@gmail.com>
15 lines
439 B
Rust
15 lines
439 B
Rust
use crate::App;
|
|
use std::any::Any;
|
|
|
|
/// A collection of Bevy App logic and configuration
|
|
///
|
|
/// Plugins configure an [App](crate::App). When an [App](crate::App) registers
|
|
/// a plugin, the plugin's [Plugin::build] function is run.
|
|
pub trait Plugin: Any + Send + Sync {
|
|
fn build(&self, app: &mut App);
|
|
fn name(&self) -> &str {
|
|
std::any::type_name::<Self>()
|
|
}
|
|
}
|
|
|
|
pub type CreatePlugin = unsafe fn() -> *mut dyn Plugin;
|