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
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
use Any;
use Arc;
use ;
/// A lifecycle participant.
///
/// Plain values use `Registry::insert` and implement nothing. `Register`
/// composes the application; `Component` describes the participants in its
/// ordered lifecycle. A component exposes only the capabilities it has,
/// through `as_*` hooks, either on itself or on a separate object.
///
/// # Dependencies
///
/// `Deps` names what the component requires in order to boot and run: a
/// tuple of `Arc<T>` values, `Option<Arc<T>>` for a requirement that may be
/// absent, or `()`. The registry resolves it before `Bootable::boot` and
/// before each run generation and passes the result in; a missing dependency
/// is one error naming this component and the missing type. Registered
/// components named in `Deps` boot before this one.
///
/// A component that only uses another when it happens to be present, and
/// serves without it, does not list it here. It resolves the value at the
/// point of use and states a preferred start order through `run_priority`.
///
/// # Ordering
///
/// `order` places the component relative to layers or preparation components:
/// `after::<Network>()` where `Network` is a marker type
/// nobody registers. Such a type acts as a target, complete once everything
/// ordered `before` it has completed. Priorities order components that are
/// otherwise independent and never override a dependency or an `order` edge.
/// When boot publishes a plain DI value, `Deps` cannot infer its producer;
/// retain an explicit order after the component that prepares that value.
///
/// # Lifecycle boundaries
///
/// `Register` composes the application synchronously. `Bootable::boot`
/// performs finite preparation in dependency order; no listener or long-lived
/// task starts there. `validate` checks readiness before runnables are
/// admitted. `Runnable::run` owns operational work and its graceful drain.
/// `Finalizable::finalize` releases prepared, non-running resources in reverse
/// order after runnables have drained; it is not a stop hook.