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
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
//! THE SLOT SEAM — what one field of a COMPOSED filter is, resolved by the compiler rather than by
//! the derive reading tokens.
//!
//! `#[derive(ingraph::Filter)]`'s composed identity takes a hand-written filter struct and emits its
//! wire face from the fields themselves: the struct IS the vocabulary. To do that the emitter has to
//! know, per field, WHICH of four shapes it is — and it cannot know from the tokens. `Option<Rate>`
//! and `Option<ScalarFilter<i32>>` are one shape to a proc macro and two shapes on the wire: the
//! first crosses through the element's own carrier and the second is a whole nested filter. So the
//! question is asked of the TYPE SYSTEM, at the emitted call, and the answer is a trait row.
//!
//! # The four shapes, and the three rows that carry them
//!
//! | a field written… | is | what it registers |
//! |---|---|---|
//! | `Option<T>` where `T: ToGraphqlInput` | ONE operand | `Option<T::Input>` — the element's own carrier |
//! | `Option<Box<[T]>>` where `T: ToGraphqlInput` | a LIST of operands | `Option<Box<[T::Input]>>` |
//! | `Option<Utf8Bytes>` | one TEXT operand | `Option<String>` — the row above, at the UTF-8 household |
//! | `Option<F>` where `F: GraphqlFilter` | a NESTED filter | `Option<F>`, whole |
//!
//! **The text shape is the operand row and not a fourth impl**, which is arithmetic rather than a
//! simplification: `smol_bytes::Utf8Bytes` already carries [`ToGraphqlInput`] with `Input = String`,
//! crossing IN through `From<String>` and OUT through `as_str().to_owned()` — a COPY rather than a
//! conversion, which is exactly what a hand-written render facet writes for it and exactly what the
//! reading in [`carrier`](super::super::carrier) publishes. A row of its own beside the operand row
//! would be `E0119` against it and would buy nothing: same registration, same bytes on the wire.
//!
//! # `K` is a MARKER and it is what keeps the rows apart
//!
//! Two of the three rows are over `Option<_>` and would overlap as one trait — coherence cannot rule
//! out a downstream type that is both `ToGraphqlInput` and [`GraphqlFilter`], and negative reasoning
//! is not available on stable. Parameterising by a KIND makes them `FilterSlot<OneOperand>` and
//! `FilterSlot<NestedFilter>`, which are different traits as far as coherence is concerned, and the
//! emitter never spells the marker: it writes `FilterSlot<_>` and inference picks the one row that
//! applies. A type answering TWO of them is an ambiguity at the declaration rather than a silent
//! choice, which is the honest failure for a field whose meaning is genuinely two things.
//!
//! # TWO traits, because emptiness is not a wire question
//!
//! [`FilterSlot`] is UNGATED and answers one thing: does this slot ask anything. That is what
//! [`GraphqlFilter`] wants, it is the same answer on every backend, and a build with no binding at
//! all still has lowerings that ask it.
//!
//! [`SlotFace`] is the WIRE half — what the slot registers, how it is read off a parsed object and
//! how it is written back — and it rides the binding gate, because every one of those three names an
//! async-graphql type. The supertrait is what makes a slot one thing said twice rather than two
//! things that could disagree.
//!
//! # The EMPTINESS law, which is `ListFilter`'s and is restated here rather than re-decided
//!
//! An absent operand asks nothing, so `None` is empty at the first three shapes. A NESTED filter
//! folds in: `Some(f)` is empty exactly while `f` is, because asking no question about a component
//! excludes no row. That is [`Nullable`](crate::Nullable)'s fold-in and this crate's rule for a
//! nested filter — see [`ListFilter`](crate::ListFilter)'s own note, where the one EXCEPTION is
//! written down: a QUANTIFIED slot (`any`) is not empty when it holds an empty filter, because
//! `∃x ∈ S. true` is `S ≠ ∅`, which is a predicate. A composed filter has no quantifier — its slots
//! are operators over one subject rather than over a collection — so the exception has nothing to
//! attach to here, and the fold-in is the whole law.
use GraphqlFilter;
use crateToGraphqlInput;
/// The kind marker for ONE OPERAND — a slot holding a single value of the subject's own element
/// type, crossing on that element's carrier.
///
/// Uninhabited, for the reason every marker in this crate is: it is a name a row is filed under and
/// never a value anybody holds.
///
/// # The three names are LONGER than the words they stand for, and that is measured
///
/// `Operand`, `Operands` and `Nested` are what these are about, and the first of them is a name this
/// crate already uses: four SQL and Mongo crossing errors carry an `Operand` VARIANT, and with a
/// dialect feature on, rustc prints the marker as `ingraph::Operand` where it prints the bare word
/// without one. That difference lands inside `tests/composed_slot_shape`'s golden, which would then
/// be a pinned diagnostic that depends on the feature set it was blessed under — a lane red on the
/// obvious minimal command for no reason at all.
///
/// So the trio is spelled with the word that disambiguates it, and the pin is feature-independent.
/// The kind marker for a LIST OF OPERANDS — the `in` / `notIn` shape, crossing as a list of the
/// element's carrier. See [`OneOperand`] for why the name is not `Operands`.
/// The kind marker for a NESTED FILTER — a slot holding a whole filter over a component of the
/// subject, crossing as that filter's own input object. See [`OneOperand`] for why the name is not
/// `Nested`.
/// Which SHAPE one slot of a composed filter is, and whether it asks anything.
///
/// The half that is not about the wire, so a build with no binding still has it — see the module
/// note for why the trait is split and for the emptiness law this method states.
/// ONE operand. `None` asks nothing.
/// A LIST of operands. `None` asks nothing — and an EMPTY list does not: `in: []` is a membership
/// test against no value, which is a predicate that excludes every row rather than the absence of
/// one.
/// A NESTED filter, which FOLDS IN: a present component filter that asks nothing leaves this slot
/// asking nothing. The module note is where the law is, and where `ListFilter`'s one exception to it
/// is named.
/// The WIRE half of a slot: what it registers, how it is read off a parsed object, and how it is
/// written back.
///
/// Behind the binding gate, all three methods naming an async-graphql type. The supertrait is what
/// keeps a slot ONE decision — a shape that crosses one way and empties another would be two rulings
/// filed under one name.
// The SUPERTRAIT already carries the whole sentence, and it fails first — so this note says where
// to read rather than restating it. A bound with no note at all is what a reader would otherwise
// get twice from one field.