bevy/crates/bevy_app/src/plugin.rs
2021-07-24 16:43:37 -07:00

16 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;