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
43
44
45
46
47
48
49
50
// src/ecs/system.rs
//
// The runtime behavior trait every engine system implements, plus its per-step
// control signal. Renderer-free: `System` names only `PipelineContext` (which is
// core), so it lives here where the physics / audio subsystem crates can name it
// without depending on the renderer. The client `ecs` module re-exports both
// under the historical `crate::ecs::*` paths, and its `define_systems!` table
// names each system's gate; a world holds the built systems as trait objects.
use crate;
/// What a system asks the world to do after its step.
/// System -- has behavior, receives a PipelineContext each tick. Every system
/// is internal engine code: `World::start` constructs it from world components
/// (via the system's own `new(..)`), so a system is never loaded from or
/// written to a blob. `init` runs once at `World::start`; `step` runs every
/// tick.
///
/// A world holds its systems as `dyn System`, so the trait is object-safe.
/// `Send` is what lets a built world move to the simulation thread, and `Any`
/// is what lets a caller holding the world reach one system as its own type
/// (the `cn debug` / `cn editor` hot-reload drive).