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
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
//! The SOURCE declaration's emission: the DOUBLE ENTRY, which is the whole of what a source
//! declaration writes.
//!
//! ```ignore
//! #[ingraph::source(async, mutation(node = "WatchOps"))]
//! pub struct Watch { … }
//!
//! impl AsyncSource for Watch {
//! type Mutation = WatchOps; // the TYPE half — the author's own hand
//! …
//! }
//! ```
//!
//! # Two entries for one fact, and the emission is what holds them together
//!
//! A source's command face is written TWICE, and neither spelling can be dropped. The WORD is what
//! the declaration says — it is what a manifest front end, a schema walk and a reader see — and the
//! TYPE is what the compiler resolves a [`Control`](../../ingraph/struct.Control.html) line through.
//! Two macro expansions cannot read each other's tokens and an attribute macro cannot write somebody
//! else's `impl`, so the word cannot mint the type and the type cannot mint the word.
//!
//! What this emission writes is the JOIN: one bound, stated over the declared type, naming the node
//! the word named. So the two entries are checked against each other at the declaration, in BOTH
//! directions:
//!
//! | written | what happens |
//! |---|---|
//! | `mutation(node = "WatchOps")` and `type Mutation = WatchOps` | it compiles |
//! | `mutation(node = "WatchOps")` and `type Mutation = ()` (or another node) | `E0271` at the WORD |
//! | no word and `type Mutation = WatchOps` | `E0271` at the DECLARATION |
//! | no word and `type Mutation = ()` | it compiles |
//!
//! The third row is the one a single-entry design would have lost: a source that mounted a node and
//! forgot to say so would publish no wire face and no reader would ever know, because a missing word
//! looks exactly like a source nobody controls. The bound is what makes silence impossible.
//!
//! # The FACE is the `async` word's, and the word is what names the trait
//!
//! `#[ingraph::source]` binds [`Source`](../../ingraph/trait.Source.html) and
//! `#[ingraph::source(async)]` binds [`AsyncSource`](../../ingraph/trait.AsyncSource.html) — the
//! dual-mode law's word-selects-face rule, applied at the one position that has to name a trait to
//! state anything at all. A declaration whose word and whose `impl` disagree is `E0277` at the
//! declaration, naming the face it does not wear, which is what
//! [`Source`](../../ingraph/trait.Source.html)'s own `on_unimplemented` note is written for.
//!
//! # THE RECORD a launch walk mounts it through
//!
//! Beside the entry, one impl:
//!
//! ```ignore
//! impl DeclaredOrigin for Watch {
//! type Mode = Block; // the `async` word, as a TYPE
//! const MOUNTS: Option<&'static str> = Some("WatchOps");
//! }
//! ```
//!
//! `Declared`'s own arrangement for the origin layer: a walk that mounts an origin sees a type, so
//! the declaration STATES what it is and the walk NAMES it through a projection. The `Mode` seat is
//! what makes one mount door serve both faces, and the string is for a reader rather than for the
//! compiler — what resolves the mount is the seat the double entry is stated over.
//!
//! # NOTHING ELSE is emitted
//!
//! No command enum (the node's own declaration mints it), no `MutationNode` row (the node's), no
//! resolver (the node's binding pass). The host is echoed, one anonymous `const` is written beside
//! it, and the record above.
use ;
use Spanned as _;
/// A validated source declaration, ready to emit.
///
/// PLAIN, for the reason every model in this crate has plain fields: the derive today and a manifest
/// front end later reach the same emitter.