1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
//! Plugin trait for composable resource registration.
use crateWorldBuilder;
/// Composable unit of resource registration.
///
/// Analogous to Bevy's `Plugin`.
///
/// Plugins register resources into a [`WorldBuilder`]. The runtime is
/// assembled by installing plugins via [`WorldBuilder::install_plugin`].
///
/// When choosing how to register — [`register`](WorldBuilder::register) for a
/// resource the plugin owns, [`ensure`](WorldBuilder::ensure) /
/// [`ensure_default`](WorldBuilder::ensure_default) for one it shares with other
/// plugins — see the owned-vs-shared guidance on the
/// [`Installer`](crate::Installer) trait.
///
/// # Examples
///
/// ```ignore
/// struct TradingPlugin;
///
/// impl Plugin for TradingPlugin {
/// fn build(self, world: &mut WorldBuilder) {
/// world.register(PriceCache::new());
/// world.register(TradeState::default());
/// }
/// }
///
/// let mut wb = WorldBuilder::new();
/// wb.install_plugin(TradingPlugin);
/// ```