Trait FnPluginsExt

Source
pub trait FnPluginsExt {
    // Required method
    fn fn_plugins<T>(&mut self, f: impl FnPlugins<T>) -> &mut Self;
}

Required Methods§

Source

fn fn_plugins<T>(&mut self, f: impl FnPlugins<T>) -> &mut Self

Extended App method that adds functions as plugins to the main bevy app. Useful for creating plugin hierarchies (struct Plugins as base plugins and fn plugins as sub-plugins). This method is heavily inspired by bevy’s App::add_plugins method.

use bevy::prelude::*;

fn main() {
    App::new().fn_plugins(example_plugin).run();
}

fn example_plugin(app: &mut App) {
    println!("Hello from example_plugin!");
}

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.

Implementations on Foreign Types§

Source§

impl FnPluginsExt for App

Source§

fn fn_plugins<T>(&mut self, f: impl FnPlugins<T>) -> &mut Self

Implementors§