bevy_discovery

Crates.iobevy_discovery
lib.rsbevy_discovery
version0.1.0
sourcesrc
created_at2021-01-01 12:05:39.920157
updated_at2021-01-01 12:05:39.920157
descriptionAutomatic system discovery and registration for Bevy apps
homepage
repositoryhttps://github.com/TheRawMeatball/bevy_discovery
max_upload_size
id330062
size14,677
Nile (TheRawMeatball)

documentation

README

Bevy Discovery

This crate adds #[derive(DiscoveryPlugin)] which will scan the project files for functions annotated with #[system] and register them automagically. Example:

use bevy::prelude::*;

#[macro_use]
extern crate bevy_discovery;

fn main() {
    App::build()
        .add_plugin(DiscoveryPlugin)
        .run();
}

#[system]
fn discovered_system() {
    println!("Woo, discovered system!");
}

#[system(stage::POST_UPDATE)]
fn post_update_system() {
    println!("Hey, post update system!");
}

#[derive(DiscoveryPlugin)]
struct DiscoveryPlugin;

Compile time performance

Full rebuild Incremental
Normal 198.982 ± 1.167 s 25.944 ± 1.486 s
Discovered 207.636 ± 3.785 s 26.546 ± 1.782 s

These are the compile times for my fork of bevy-robbo, averaged over five runs with a discarded warmup round each using hyperfine.

Commit count: 5

cargo fmt