ingraph 0.1.0

A declaration-driven indexing framework: records and nodes are written as Rust types, and the storage rows, the dataflow between them and the GraphQL query surface are emitted from the declaration.
Documentation
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
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
use core::marker::PhantomData;

use super::*;
use crate::graphql::carrier::Builtin;

/// The text filter — generic over the column's string storage type `S` (`String`, `SmolStr`,
/// `Box<str>`, …), mirroring polarsync's `StringFilter<I>` (bound `AsRef<str>`, not `Display`:
/// tighter, and it borrows the value rather than forcing a `to_string`), and over the WIRE READING
/// `I` its operands cross under. Equality, ordering, membership, and the substring / affix operators
/// with their case-insensitive (`_nocase`) and negated (`not_`) variants — each of the twelve is its
/// own slot, and a backend lowering reads them as (kind, negated, nocase) triples over one dialect
/// leaf. Bound-free struct; the `AsRef<str>` belongs on the lowering impls. Constructed via
/// `new()`/`Default` + the `opt_accessor!` writers, and read through its getters (a
/// `#[derive(Default)]` would both spuriously add `S: Default` and duplicate `new()`'s canonical
/// empty value).
///
/// # The second parameter, and what it is for
///
/// `I` names the reading the operands cross the wire under — see [`TextWire`](crate::TextWire) — and
/// it is what lets a DECLARING crate give its own text type a wire face. The framework's wire face is
/// ONE generic row over `I`, so there is no second row for coherence to hit and the PARAMETER
/// renames nothing: [`Builtin`] carries `String` under the canonical `StringFilter` and `SmolStr`
/// under `TextFilter`, and a declaring crate carries its own text newtype under whatever its own
/// marker says.
///
/// Those names are the household register read in one line: lowercase is the framework's own SCALAR
/// vocabulary, and a filter is an input object, so every one of these is Pascal. `String` is not a
/// roster row at all since the 2026-08-18 amendment — GraphQL's own name says everything there is to
/// say about the operand — so there is one reading of it and not two, the roster's
/// `string` row having taken its NAME without one; see [`roster`](crate::graphql::roster), where
/// what minting one would cost is stated.
///
/// It DEFAULTS, so every spelling written before the axis existed means what it meant:
/// `TextFilter<String>` IS `TextFilter<String, Builtin>`.
///
/// The parameter takes no part in the operators, the crossing into a comparison, or storage — it is
/// read at the wire face and nowhere else, which is why [`try_map`](Self::try_map) carries it
/// through unchanged: what a storage type changes is the VALUE, not the reading.
pub struct TextFilter<S, I = Builtin> {
  pub(crate) eq: Option<S>,
  pub(crate) ne: Option<S>,
  pub(crate) gt: Option<S>,
  pub(crate) gte: Option<S>,
  pub(crate) lt: Option<S>,
  pub(crate) lte: Option<S>,
  pub(crate) contains: Option<S>,
  pub(crate) contains_nocase: Option<S>,
  pub(crate) not_contains: Option<S>,
  pub(crate) not_contains_nocase: Option<S>,
  pub(crate) starts_with: Option<S>,
  pub(crate) starts_with_nocase: Option<S>,
  pub(crate) not_starts_with: Option<S>,
  pub(crate) not_starts_with_nocase: Option<S>,
  pub(crate) ends_with: Option<S>,
  pub(crate) ends_with_nocase: Option<S>,
  pub(crate) not_ends_with: Option<S>,
  pub(crate) not_ends_with_nocase: Option<S>,
  pub(crate) in_: Option<Box<[S]>>,
  pub(crate) not_in: Option<Box<[S]>>,
  // `fn() -> I` (not a bare `I`) so the reading contributes no auto-trait or variance obligation:
  // the filter is `Send`/`Sync` on `S` alone, exactly as before the parameter existed. The same
  // shape [`BytesFilter`]'s storage-shape parameter takes, for the same reason.
  pub(crate) wire: PhantomData<fn() -> I>,
}

impl<S, I> TextFilter<S, I> {
  /// The empty filter — no operator set.
  #[inline]
  pub const fn new() -> Self {
    Self {
      eq: None,
      ne: None,
      gt: None,
      gte: None,
      lt: None,
      lte: None,
      contains: None,
      contains_nocase: None,
      not_contains: None,
      not_contains_nocase: None,
      starts_with: None,
      starts_with_nocase: None,
      not_starts_with: None,
      not_starts_with_nocase: None,
      ends_with: None,
      ends_with_nocase: None,
      not_ends_with: None,
      not_ends_with_nocase: None,
      in_: None,
      not_in: None,
      wire: PhantomData,
    }
  }

  /// True while NO operator slot is set — so a lowering would emit nothing for this field.
  ///
  /// Inherent, not the backend traits' provided `is_empty`: "is anything set" is a property of the
  /// FILTER, identical on every backend, and asking it should not make a caller name a dialect (with
  /// two families compiled, `f.is_empty()` through the traits is `E0283`). The inherent method wins
  /// method resolution, so every call site reads the same either way.
  #[inline]
  pub const fn is_empty(&self) -> bool {
    self.eq.is_none()
      && self.ne.is_none()
      && self.gt.is_none()
      && self.gte.is_none()
      && self.lt.is_none()
      && self.lte.is_none()
      && self.contains.is_none()
      && self.contains_nocase.is_none()
      && self.not_contains.is_none()
      && self.not_contains_nocase.is_none()
      && self.starts_with.is_none()
      && self.starts_with_nocase.is_none()
      && self.not_starts_with.is_none()
      && self.not_starts_with_nocase.is_none()
      && self.ends_with.is_none()
      && self.ends_with_nocase.is_none()
      && self.not_ends_with.is_none()
      && self.not_ends_with_nocase.is_none()
      && self.in_.is_none()
      && self.not_in.is_none()
  }

  opt_accessor!(eq: S => with_eq, set_eq, maybe_eq, update_eq);
  opt_accessor!(ne: S => with_ne, set_ne, maybe_ne, update_ne);
  opt_accessor!(gt: S => with_gt, set_gt, maybe_gt, update_gt);
  opt_accessor!(gte: S => with_gte, set_gte, maybe_gte, update_gte);
  opt_accessor!(lt: S => with_lt, set_lt, maybe_lt, update_lt);
  opt_accessor!(lte: S => with_lte, set_lte, maybe_lte, update_lte);
  opt_accessor!(contains: S => with_contains, set_contains, maybe_contains, update_contains);
  opt_accessor!(
    contains_nocase: S =>
      with_contains_nocase,
      set_contains_nocase,
      maybe_contains_nocase,
      update_contains_nocase
  );
  opt_accessor!(
    not_contains: S => with_not_contains, set_not_contains, maybe_not_contains, update_not_contains
  );
  opt_accessor!(
    not_contains_nocase: S =>
      with_not_contains_nocase,
      set_not_contains_nocase,
      maybe_not_contains_nocase,
      update_not_contains_nocase
  );
  opt_accessor!(
    starts_with: S => with_starts_with, set_starts_with, maybe_starts_with, update_starts_with
  );
  opt_accessor!(
    starts_with_nocase: S =>
      with_starts_with_nocase,
      set_starts_with_nocase,
      maybe_starts_with_nocase,
      update_starts_with_nocase
  );
  opt_accessor!(
    not_starts_with: S =>
      with_not_starts_with,
      set_not_starts_with,
      maybe_not_starts_with,
      update_not_starts_with
  );
  opt_accessor!(
    not_starts_with_nocase: S =>
      with_not_starts_with_nocase,
      set_not_starts_with_nocase,
      maybe_not_starts_with_nocase,
      update_not_starts_with_nocase
  );
  opt_accessor!(ends_with: S => with_ends_with, set_ends_with, maybe_ends_with, update_ends_with);
  opt_accessor!(
    ends_with_nocase: S =>
      with_ends_with_nocase,
      set_ends_with_nocase,
      maybe_ends_with_nocase,
      update_ends_with_nocase
  );
  opt_accessor!(
    not_ends_with: S =>
      with_not_ends_with,
      set_not_ends_with,
      maybe_not_ends_with,
      update_not_ends_with
  );
  opt_accessor!(
    not_ends_with_nocase: S =>
      with_not_ends_with_nocase,
      set_not_ends_with_nocase,
      maybe_not_ends_with_nocase,
      update_not_ends_with_nocase
  );
  opt_accessor!(in_: [S] => with_in_, set_in_, maybe_in_, update_in_);
  opt_accessor!(not_in: [S] => with_not_in, set_not_in, maybe_not_in, update_not_in);

  /// True when this filter's ONLY set operator is a plain `eq` or a plain `in_` — the shape a
  /// relation may rewrite onto the PARENT's foreign key instead of running a subquery.
  ///
  /// Sound only under referential integrity: every fk references an existing child row, so
  /// `fk IN (SELECT key FROM child WHERE key = v)` is exactly `fk = v`. A negated shape
  /// (`ne`/`not_in`) is NOT equivalent under dangling references, an ordering operator does not
  /// name a single child row, and a case-insensitive match compares differently on the two
  /// columns — so none of them ever collapses.
  #[inline]
  pub const fn is_referential(&self) -> bool {
    (self.eq.is_some() ^ self.in_.is_some())
      && self.ne.is_none()
      && self.gt.is_none()
      && self.gte.is_none()
      && self.lt.is_none()
      && self.lte.is_none()
      && self.contains.is_none()
      && self.contains_nocase.is_none()
      && self.not_contains.is_none()
      && self.not_contains_nocase.is_none()
      && self.starts_with.is_none()
      && self.starts_with_nocase.is_none()
      && self.not_starts_with.is_none()
      && self.not_starts_with_nocase.is_none()
      && self.ends_with.is_none()
      && self.ends_with_nocase.is_none()
      && self.not_ends_with.is_none()
      && self.not_ends_with_nocase.is_none()
      && self.not_in.is_none()
  }

  /// Convert every set operand with `f`, keeping the operator set exactly as it stands — see
  /// [`ScalarFilter::try_map`] for what this primitive is for and what it promises about lists.
  ///
  /// Twenty slots and one converter: the twelve substring / affix operands cross exactly as the six
  /// ordering ones do, because what a storage type changes is the VALUE and not the question. A
  /// column stored as `SmolStr` and asked `starts_with` still asks about a prefix.
  pub fn try_map<U, E, F>(self, mut f: F) -> Result<TextFilter<U, I>, E>
  where
    F: FnMut(S) -> Result<U, E>,
  {
    Ok(TextFilter {
      eq: map_operand(self.eq, &mut f)?,
      ne: map_operand(self.ne, &mut f)?,
      gt: map_operand(self.gt, &mut f)?,
      gte: map_operand(self.gte, &mut f)?,
      lt: map_operand(self.lt, &mut f)?,
      lte: map_operand(self.lte, &mut f)?,
      contains: map_operand(self.contains, &mut f)?,
      contains_nocase: map_operand(self.contains_nocase, &mut f)?,
      not_contains: map_operand(self.not_contains, &mut f)?,
      not_contains_nocase: map_operand(self.not_contains_nocase, &mut f)?,
      starts_with: map_operand(self.starts_with, &mut f)?,
      starts_with_nocase: map_operand(self.starts_with_nocase, &mut f)?,
      not_starts_with: map_operand(self.not_starts_with, &mut f)?,
      not_starts_with_nocase: map_operand(self.not_starts_with_nocase, &mut f)?,
      ends_with: map_operand(self.ends_with, &mut f)?,
      ends_with_nocase: map_operand(self.ends_with_nocase, &mut f)?,
      not_ends_with: map_operand(self.not_ends_with, &mut f)?,
      not_ends_with_nocase: map_operand(self.not_ends_with_nocase, &mut f)?,
      in_: map_operands(self.in_, &mut f)?,
      not_in: map_operands(self.not_in, &mut f)?,
      wire: PhantomData,
    })
  }
}

impl<S, I> Default for TextFilter<S, I> {
  #[inline]
  fn default() -> Self {
    Self::new()
  }
}

// `Debug`, `Clone` and `PartialEq` are written out rather than derived, for the reason
// [`BytesFilter`]'s are: a derive would put its bound on EVERY parameter, so `TextFilter<Tag,
// TagWire>` would be `Clone` only while a reading marker nobody constructs were `Clone` too. The
// operands decide, and the reading takes no part.
impl<S: core::fmt::Debug, I> core::fmt::Debug for TextFilter<S, I> {
  fn fmt(&self, f: &mut core::fmt::Formatter<'_>) -> core::fmt::Result {
    f.debug_struct("TextFilter")
      .field("eq", &self.eq)
      .field("ne", &self.ne)
      .field("gt", &self.gt)
      .field("gte", &self.gte)
      .field("lt", &self.lt)
      .field("lte", &self.lte)
      .field("contains", &self.contains)
      .field("contains_nocase", &self.contains_nocase)
      .field("not_contains", &self.not_contains)
      .field("not_contains_nocase", &self.not_contains_nocase)
      .field("starts_with", &self.starts_with)
      .field("starts_with_nocase", &self.starts_with_nocase)
      .field("not_starts_with", &self.not_starts_with)
      .field("not_starts_with_nocase", &self.not_starts_with_nocase)
      .field("ends_with", &self.ends_with)
      .field("ends_with_nocase", &self.ends_with_nocase)
      .field("not_ends_with", &self.not_ends_with)
      .field("not_ends_with_nocase", &self.not_ends_with_nocase)
      .field("in_", &self.in_)
      .field("not_in", &self.not_in)
      .finish()
  }
}

impl<S: Clone, I> Clone for TextFilter<S, I> {
  fn clone(&self) -> Self {
    Self {
      eq: self.eq.clone(),
      ne: self.ne.clone(),
      gt: self.gt.clone(),
      gte: self.gte.clone(),
      lt: self.lt.clone(),
      lte: self.lte.clone(),
      contains: self.contains.clone(),
      contains_nocase: self.contains_nocase.clone(),
      not_contains: self.not_contains.clone(),
      not_contains_nocase: self.not_contains_nocase.clone(),
      starts_with: self.starts_with.clone(),
      starts_with_nocase: self.starts_with_nocase.clone(),
      not_starts_with: self.not_starts_with.clone(),
      not_starts_with_nocase: self.not_starts_with_nocase.clone(),
      ends_with: self.ends_with.clone(),
      ends_with_nocase: self.ends_with_nocase.clone(),
      not_ends_with: self.not_ends_with.clone(),
      not_ends_with_nocase: self.not_ends_with_nocase.clone(),
      in_: self.in_.clone(),
      not_in: self.not_in.clone(),
      wire: PhantomData,
    }
  }
}

impl<S: PartialEq, I> PartialEq for TextFilter<S, I> {
  fn eq(&self, other: &Self) -> bool {
    self.eq == other.eq
      && self.ne == other.ne
      && self.gt == other.gt
      && self.gte == other.gte
      && self.lt == other.lt
      && self.lte == other.lte
      && self.contains == other.contains
      && self.contains_nocase == other.contains_nocase
      && self.not_contains == other.not_contains
      && self.not_contains_nocase == other.not_contains_nocase
      && self.starts_with == other.starts_with
      && self.starts_with_nocase == other.starts_with_nocase
      && self.not_starts_with == other.not_starts_with
      && self.not_starts_with_nocase == other.not_starts_with_nocase
      && self.ends_with == other.ends_with
      && self.ends_with_nocase == other.ends_with_nocase
      && self.not_ends_with == other.not_ends_with
      && self.not_ends_with_nocase == other.not_ends_with_nocase
      && self.in_ == other.in_
      && self.not_in == other.not_in
  }
}

/// The bound's row: the SUBSTRING operands cross with the equality ones, because every slot this
/// kind carries is made of the same `S`.
///
/// The READING rides through unchanged. A crossing converts the operands and asks nothing of the
/// wire, so a filter read under a declarer's marker keeps that marker on the other side — the
/// alternative, resetting it to [`Builtin`], would silently claim the framework's reading of a type
/// it has never heard of.
impl<S, U, I> TryMapFilter<S, U> for TextFilter<S, I> {
  type Mapped = TextFilter<U, I>;

  #[inline]
  fn try_map_filter<E, F>(self, f: F) -> Result<Self::Mapped, E>
  where
    F: FnMut(S) -> Result<U, E>,
  {
    self.try_map(f)
  }
}

/// The bound's row: `new()` and the inherent `with_eq`, reached where the kind is a parameter rather
/// than a spelling.
impl<S, I> EqualsFilter<S> for TextFilter<S, I> {
  #[inline]
  fn equals(value: S) -> Self {
    Self::new().with_eq(value)
  }
}

impl<S, I> GraphqlFilter for TextFilter<S, I> {
  #[inline]
  fn is_empty(&self) -> bool {
    Self::is_empty(self)
  }
}

/// One inline slot, read off a parsed object and CROSSED into the domain operand.
///
/// A free function per shape rather than the line repeated twenty times, and generic over the
/// READING rather than over a wire type named at each call: the reading is what says which carrier a
/// slot holds, so naming it once at the impl is what keeps the twenty slots from disagreeing.
///
/// The four here BIND the reading and delegate the crossing to [`via`], where the same four serve
/// the scalar and byte faces: what a text slot does with a refusal is what an ordering slot does
/// with one, so the promises live in one body rather than in three.
#[cfg(feature = "async-graphql")]
fn cross_slot<S, I, F>(
  object: &async_graphql::indexmap::IndexMap<async_graphql::Name, async_graphql::Value>,
  name: &str,
) -> Result<Option<S>, async_graphql::InputValueError<F>>
where
  I: crate::TextWire<S>,
  I::Carrier: async_graphql::InputType,
  F: async_graphql::InputType,
{
  via::crossed(object, name, I::cross)
}

/// One LIST slot, crossed element by element. The FIRST refusal is the answer.
#[cfg(feature = "async-graphql")]
fn cross_slots<S, I, F>(
  object: &async_graphql::indexmap::IndexMap<async_graphql::Name, async_graphql::Value>,
  name: &str,
) -> Result<Option<Box<[S]>>, async_graphql::InputValueError<F>>
where
  I: crate::TextWire<S>,
  I::Carrier: async_graphql::InputType,
  F: async_graphql::InputType,
{
  via::crossed_list(object, name, I::cross)
}

/// One inline slot, written back onto the wire through the reading's carrier.
#[cfg(feature = "async-graphql")]
fn carry_slot<S, I>(slot: &Option<S>) -> async_graphql::Value
where
  I: crate::TextWire<S>,
  I::Carrier: async_graphql::InputType,
{
  via::carried(slot, I::carry)
}

/// One LIST slot, written back element by element.
#[cfg(feature = "async-graphql")]
fn carry_slots<S, I>(slot: &Option<Box<[S]>>) -> async_graphql::Value
where
  I: crate::TextWire<S>,
  I::Carrier: async_graphql::InputType,
{
  via::carried_list(slot, I::carry)
}

/// The field list this face registers, in declaration order.
///
/// One function read by the face and by its [`NullableFace`](crate::NullableFace) row alike, which is
/// what makes *the nullable face is the bare face's fields plus the null test* one list read twice
/// rather than two lists kept in step by hand. The null test itself is appended by the blanket over
/// [`Nullable`], so it is written once for every kind rather than once per kind.
///
/// Every slot is typed `I::Carrier` and not `S`: the operands cross, so what a client writes is the
/// CARRIER's form, and the domain type's own wire face — which it may not have — is exactly what this
/// face does not ask for.
#[cfg(feature = "async-graphql")]
fn text_fields<S, I>(
  registry: &mut async_graphql::registry::Registry,
) -> async_graphql::indexmap::IndexMap<::std::string::String, async_graphql::registry::MetaInputValue>
where
  I: crate::TextWire<S>,
  I::Carrier: async_graphql::InputType,
{
  __ingraph_filter_input_fields!(
    registry,
    "eq" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "ne" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "gt" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "gte" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "lt" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "lte" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "contains" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "containsNocase" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "notContains" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "notContainsNocase" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "startsWith" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "startsWithNocase" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "notStartsWith" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "notStartsWithNocase" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "endsWith" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "endsWithNocase" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "notEndsWith" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "notEndsWithNocase" : ::core::option::Option<<I as crate::TextWire<S>>::Carrier>,
    "in" : ::core::option::Option<::std::boxed::Box<[<I as crate::TextWire<S>>::Carrier]>>,
    "notIn" : ::core::option::Option<::std::boxed::Box<[<I as crate::TextWire<S>>::Carrier]>>,
  )
}

/// The object this face renders — the same twenty names in the same order the registration declares.
///
/// A function where the concrete faces spend `__ingraph_filter_value_map!`, because that macro renders each
/// slot through the DOMAIN type's own `InputType` and the whole point of a crossing is that the
/// domain type may not have one.
#[cfg(feature = "async-graphql")]
fn text_values<S, I>(
  filter: &TextFilter<S, I>,
) -> async_graphql::indexmap::IndexMap<async_graphql::Name, async_graphql::Value>
where
  I: crate::TextWire<S>,
  I::Carrier: async_graphql::InputType,
{
  let mut map = async_graphql::indexmap::IndexMap::new();
  map.insert(
    async_graphql::Name::new("eq"),
    carry_slot::<S, I>(&filter.eq),
  );
  map.insert(
    async_graphql::Name::new("ne"),
    carry_slot::<S, I>(&filter.ne),
  );
  map.insert(
    async_graphql::Name::new("gt"),
    carry_slot::<S, I>(&filter.gt),
  );
  map.insert(
    async_graphql::Name::new("gte"),
    carry_slot::<S, I>(&filter.gte),
  );
  map.insert(
    async_graphql::Name::new("lt"),
    carry_slot::<S, I>(&filter.lt),
  );
  map.insert(
    async_graphql::Name::new("lte"),
    carry_slot::<S, I>(&filter.lte),
  );
  map.insert(
    async_graphql::Name::new("contains"),
    carry_slot::<S, I>(&filter.contains),
  );
  map.insert(
    async_graphql::Name::new("containsNocase"),
    carry_slot::<S, I>(&filter.contains_nocase),
  );
  map.insert(
    async_graphql::Name::new("notContains"),
    carry_slot::<S, I>(&filter.not_contains),
  );
  map.insert(
    async_graphql::Name::new("notContainsNocase"),
    carry_slot::<S, I>(&filter.not_contains_nocase),
  );
  map.insert(
    async_graphql::Name::new("startsWith"),
    carry_slot::<S, I>(&filter.starts_with),
  );
  map.insert(
    async_graphql::Name::new("startsWithNocase"),
    carry_slot::<S, I>(&filter.starts_with_nocase),
  );
  map.insert(
    async_graphql::Name::new("notStartsWith"),
    carry_slot::<S, I>(&filter.not_starts_with),
  );
  map.insert(
    async_graphql::Name::new("notStartsWithNocase"),
    carry_slot::<S, I>(&filter.not_starts_with_nocase),
  );
  map.insert(
    async_graphql::Name::new("endsWith"),
    carry_slot::<S, I>(&filter.ends_with),
  );
  map.insert(
    async_graphql::Name::new("endsWithNocase"),
    carry_slot::<S, I>(&filter.ends_with_nocase),
  );
  map.insert(
    async_graphql::Name::new("notEndsWith"),
    carry_slot::<S, I>(&filter.not_ends_with),
  );
  map.insert(
    async_graphql::Name::new("notEndsWithNocase"),
    carry_slot::<S, I>(&filter.not_ends_with_nocase),
  );
  map.insert(
    async_graphql::Name::new("in"),
    carry_slots::<S, I>(&filter.in_),
  );
  map.insert(
    async_graphql::Name::new("notIn"),
    carry_slots::<S, I>(&filter.not_in),
  );
  map
}

/// The WIRE FACE, and the row the CARRIER AXIS was minted for: ONE generic impl over the reading,
/// where this crate carried two concrete registrations.
///
/// # What one row buys that two could not
///
/// A declaring crate cannot write `impl InputType for TextFilter<Tag>` — `E0117`, both the trait and
/// the outer type being foreign to it, and RFC 2451 does not admit `ForeignTrait for
/// ForeignType<Local>` — and this crate could not have written a generic row beside
/// `TextFilter<String>` and `TextFilter<SmolStr>`, those being two concrete impls a generic one
/// overlaps (`E0119`). So a declarer's own text type reached no schema in either crate, measured.
/// With the two concrete rows moved onto [`Builtin`] as [`TextWire`](crate::TextWire) rows there is
/// exactly one impl here, coherence has nothing to reason about, and a declaring crate joins by
/// implementing that trait on a marker it owns.
///
/// # The NAME comes from the reading
///
/// `I::NAME`, so a name is a property of the READING and never of this type: `Builtin`'s row for
/// `String` names the canonical `StringFilter` and its row for `SmolStr` names `TextFilter` — two
/// operands under two names through one face, which is what keying on the reading buys. A declarer's
/// marker names its own, and the clash rule is async-graphql's own — `Registry::create_type` panics
/// when one schema puts two Rust types under one GraphQL name, which is why `String` has ONE reading
/// rather than a `Std` row beside the default publishing the same name.
///
/// # The bound is the reading and nothing else
///
/// Not `S: InputType`: the operands cross through `I::Carrier`, so the OPERAND's own wire face is
/// exactly what this face does not ask for. That is the difference between this row and the
/// collection ones, whose element bound is [`ToGraphqlInput`](crate::ToGraphqlInput) — the same fact
/// keyed on a type instead of on a reading.
///
/// `I::Carrier: InputType` IS async-graphql's demand, and it is written HERE rather than on the
/// trait's seat because that is the law: the map says which form an operand crosses as, and each
/// backend asks what it needs of that form where it SPENDS it. So a reading whose carrier this
/// library cannot parse is `E0277` at the face that would have parsed it, and the same reading is
/// still a legal row for a second binding to read.
///
/// `S: Send + Sync` is not a second face — it is `InputType`'s own supertrait, asked of `Self` and
/// reaching `S` through the twenty `Option<S>` slots. It used to arrive free with the concrete
/// registrations' operand types and is stated now that the operand is a parameter.
#[cfg(feature = "async-graphql")]
impl<S, I> async_graphql::InputType for TextFilter<S, I>
where
  S: Send + Sync,
  I: crate::TextWire<S>,
  I::Carrier: async_graphql::InputType,
{
  type RawValueType = Self;

  #[inline]
  fn type_name() -> ::std::borrow::Cow<'static, str> {
    ::std::borrow::Cow::Borrowed(<I as crate::TextWire<S>>::NAME)
  }

  fn create_type_info(registry: &mut async_graphql::registry::Registry) -> ::std::string::String {
    registry.create_input_type::<Self, _>(
      async_graphql::registry::MetaTypeId::InputObject,
      |registry| async_graphql::registry::MetaType::InputObject {
        name: ::std::string::String::from(<I as crate::TextWire<S>>::NAME),
        description: ::std::option::Option::None,
        input_fields: text_fields::<S, I>(registry),
        visible: ::std::option::Option::None,
        inaccessible: false,
        tags: ::std::vec::Vec::new(),
        rust_typename: ::std::option::Option::Some(::std::any::type_name::<Self>()),
        oneof: false,
        directive_invocations: ::std::vec::Vec::new(),
      },
    )
  }

  fn parse(
    value: ::std::option::Option<async_graphql::Value>,
  ) -> async_graphql::InputValueResult<Self> {
    let object = match super::sent(value) {
      super::Sent::Longhand(object) => object,
      // Rule ① — a bare value is this filter's `eq`, put under that key so the CARRIER crossing
      // below is the same one the longhand takes rather than a second reading of the operand.
      super::Sent::Bare(bare) => {
        let mut object = async_graphql::indexmap::IndexMap::new();
        object.insert(async_graphql::Name::new("eq"), bare);
        object
      }
      super::Sent::Null => {
        return ::std::result::Result::Err(async_graphql::InputValueError::expected_type(
          async_graphql::Value::Null,
        ));
      }
      super::Sent::Refused(sent) => {
        return ::std::result::Result::Err(async_graphql::InputValueError::expected_type(sent));
      }
    };
    {
      ::std::result::Result::Ok(Self {
        eq: cross_slot::<S, I, Self>(&object, "eq")?,
        ne: cross_slot::<S, I, Self>(&object, "ne")?,
        gt: cross_slot::<S, I, Self>(&object, "gt")?,
        gte: cross_slot::<S, I, Self>(&object, "gte")?,
        lt: cross_slot::<S, I, Self>(&object, "lt")?,
        lte: cross_slot::<S, I, Self>(&object, "lte")?,
        contains: cross_slot::<S, I, Self>(&object, "contains")?,
        contains_nocase: cross_slot::<S, I, Self>(&object, "containsNocase")?,
        not_contains: cross_slot::<S, I, Self>(&object, "notContains")?,
        not_contains_nocase: cross_slot::<S, I, Self>(&object, "notContainsNocase")?,
        starts_with: cross_slot::<S, I, Self>(&object, "startsWith")?,
        starts_with_nocase: cross_slot::<S, I, Self>(&object, "startsWithNocase")?,
        not_starts_with: cross_slot::<S, I, Self>(&object, "notStartsWith")?,
        not_starts_with_nocase: cross_slot::<S, I, Self>(&object, "notStartsWithNocase")?,
        ends_with: cross_slot::<S, I, Self>(&object, "endsWith")?,
        ends_with_nocase: cross_slot::<S, I, Self>(&object, "endsWithNocase")?,
        not_ends_with: cross_slot::<S, I, Self>(&object, "notEndsWith")?,
        not_ends_with_nocase: cross_slot::<S, I, Self>(&object, "notEndsWithNocase")?,
        in_: cross_slots::<S, I, Self>(&object, "in")?,
        not_in: cross_slots::<S, I, Self>(&object, "notIn")?,
        wire: PhantomData,
      })
    }
  }

  fn to_value(&self) -> async_graphql::Value {
    async_graphql::Value::Object(text_values::<S, I>(self))
  }

  #[inline]
  fn as_raw_value(&self) -> ::std::option::Option<&Self::RawValueType> {
    ::std::option::Option::Some(self)
  }
}

#[cfg(feature = "async-graphql")]
impl<S, I> async_graphql::InputObjectType for TextFilter<S, I>
where
  S: Send + Sync,
  I: crate::TextWire<S>,
  I::Carrier: async_graphql::InputType,
{
}

/// The NULLABLE row — the two pieces [`Nullable`]'s own blanket assembles this kind's twin from.
///
/// It used to be a second `impl InputType for Nullable<TextFilter<S, I>>` written out here, and the
/// twenty slots were registered and rendered twice. What one row buys is what the carrier axis
/// bought the bare face one type over: the twin is now ONE impl in the whole crate, so a DECLARING
/// crate's own filter reaches a nullable column by writing this trait on a type it owns.
#[cfg(feature = "async-graphql")]
impl<S, I> crate::NullableFace for TextFilter<S, I>
where
  S: Send + Sync,
  I: crate::TextWire<S>,
  I::Carrier: async_graphql::InputType,
{
  fn bare_fields(
    registry: &mut async_graphql::registry::Registry,
  ) -> async_graphql::indexmap::IndexMap<
    ::std::string::String,
    async_graphql::registry::MetaInputValue,
  > {
    text_fields::<S, I>(registry)
  }

  fn bare_values(
    &self,
  ) -> async_graphql::indexmap::IndexMap<async_graphql::Name, async_graphql::Value> {
    text_values::<S, I>(self)
  }
}