# Bevy Discovery
This crate adds `#[derive(DiscoveryPlugin)]` which will scan the project files for
functions annotated with `#[system]` and register them automagically.
Example:
```rust
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
<table>
<tr>
<td></td>
<td>Full rebuild</td>
<td>Incremental</td>
</tr>
<tr>
<td>Normal</td>
<td>198.982 ± 1.167 s</td>
<td>25.944 ± 1.486 s</td>
</tr>
<tr>
<td>Discovered</td>
<td>207.636 ± 3.785 s</td>
<td>26.546 ± 1.782 s</td>
</tr>
</table>
These are the compile times for [my fork of bevy-robbo](https://github.com/TheRawMeatball/bevy-robbo),
averaged over five runs with a discarded warmup round each using [hyperfine](https://github.com/sharkdp/hyperfine).