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
//! The CROSSING: a wire filter becomes one database's predicate, and the operands enter storage.
//!
//! ```text
//! MediaFilter { title: Some(TextFilter::eq("reel")), mask: Some(ScalarFilter::eq(9u64)) }
//! │
//! ├─ per shared column: the comparison its filter crosses into, at the type this database pins
//! ├─ the declared operand converter, where `input(comparison(<db>(try_into = "…")))` names one
//! └─ MediaSqliteComparison<Sqlite>
//! ```
//!
//! # It names a CONCRETE backend, and that is the whole of why it can be written
//!
//! A record's comparison is generic in its database and stays that way — `<E>Filter`'s own
//! `ToDatabaseComparison<Row, Db>` is stated at a PARAMETER, so a declaration storing one dialect
//! need not compile that dialect's driver — and at a generic `Db` the crossing is unwritable. The
//! wall is measured, and it is the one `ToFlattenedComparison` records: a `where` clause whose self
//! type is `<F as ToDatabaseComparison<V, Db>>::Comparison` makes rustc resolve the projection
//! through the impl that DEFINES it, so the clause demands whatever that impl demands of `Db` —
//! `Db: sqlx::Database`, `V: Carrier<Db>` and `Db::Builder<'q> == SqlConjunction<'q, Db>`, the last
//! of which no `Db` bound can supply.
//!
//! An interface's engine face is already per database. `SqlInterface<Sqlite>` binds
//! `type Comparison = <I>SqliteComparison<Sqlite>`, the row equations name a concrete backend, and
//! the hydration does too — so this impl names the same one, rides the same gate, and every
//! projection in it NORMALISES: the comparison resolves to a concrete kind, its `TryFromFilter` row
//! is the one that kind implements, and its `try_from_filter_with` is an inherent method that
//! exists. **The record's wall is about a generic dialect and not about the crossing**, and an
//! interface simply does not have a generic dialect to be stopped by.
//!
//! # A declared converter REPLACES the chain rather than joining it
//!
//! `input(comparison(<db>(try_into = "…")))` is handed one operand and answers with the stored form,
//! and the declaration owns the whole hop. A field with no entry crosses through the stored type's
//! own [`TryFrom`] — which for the identity crossing is `Infallible` through std's own reflexive
//! blanket, so a column that stores what it holds is provably unable to refuse.
//!
//! It is not a convenience. `u64` pinned at `BeU64` has no `TryFrom` between the two — the storage
//! form is a byte layout rather than a numeric widening — so a pinned column of that shape crosses
//! through the declaration or not at all, and the refusal is `E0277` naming the pair.
//!
//! # ONE spelling, whatever KIND the column is — including a collection
//!
//! This emitter cannot tell a collection column from a scalar one and must not try: `type Ids =
//! Vec<Uuid7>` and a scalar are the same tokens, so what a column IS is the compiler's answer and
//! never this crate's reading. The declared leg is therefore written once, at two arguments, and the
//! kind the projection resolves to decides what happens.
//!
//! A collection's crossing has TWO converting slots — its own operands, and the ones inside its
//! nested `any` filter — and both are made of the same element, so ONE declaration fills both. That
//! composition lives on the kinds themselves (`SqlEdgeComparison::try_from_filter_with` and its
//! seven siblings), where the two-function entry is `try_from_filter_with_element`. So a collection
//! column reaches the declaration through the very call a scalar column reaches it through, and what
//! it refuses with is that kind's own error rather than the converter's bare one — which the
//! declared error cell absorbs exactly as it absorbs every other leg.
//!
//! **A collection column IS an interface's column**, and what settles the pin's two readings is the
//! interpretation WORD the pin carries: the crossing here is keyed on the ELEMENT a database stores
//! and the member's row holds the LIST of them, which is
//! [`InterfaceModel::stored_at`](crate::interface::InterfaceModel::stored_at) and its `row_at`
//! beside it — one function apart, one declared fact. A pin whose type is a collection and whose
//! declaration writes no word is read as a scalar at both sites, which is `E0308` at the row
//! equation naming the pair. Pinned by
//! `an_interface_operand_crossing_absorbs_a_collections_legs`, whose first refusal is this module's
//! absorption and whose second is the missing word.
//!
//! # Every refusal is bound to a NAMED type before it is converted
//!
//! Which is what makes the declared error cell's obligations legible: a cell that cannot absorb one
//! of the columns' crossings is `E0277` at the declaration naming WHICH, exactly as the hydration
//! cell's four legs already are. The default is the boxed refusal, which absorbs all of them
//! through `core`'s own blanket.
use quote;
use crate::;