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
//! What the two RATIONAL citizens share: the reduction, and the affix pattern their render facets
//! match against.
//!
//! [`Timebase`](super::Timebase) and [`Rate`](super::Rate) are reciprocal readings of one shape —
//! two `i32` columns holding a fraction — so their storage law, their render facet and the alphabet
//! that facet admits are one set of rules rather than two that happen to agree. This module is where
//! the parts of that with a body live; the parts with only a NAME stay on each type, because a
//! timebase's numerator and a rate's are different questions with the same arithmetic.
//!
//! What is NOT shared is deliberate. Each citizen keeps its own crossing error, its own roster door
//! and its own GraphQL names, because those are the things a client reads and a client is asking
//! about one of them specifically. Sharing a `%` refusal is sharing an implementation; sharing an
//! error type would be telling a client that a rate and a timebase are the same thing.
use ;
/// Euclid, over a non-negative `a` and a positive `b`.
///
/// The result is POSITIVE for every such pair — including `a = 0`, where the first iteration returns
/// `b` — which is what makes both citizens' two divisions total.
///
/// `mediatime`'s constructors pin `num >= 0` and `den > 0` on both types, so there is no sign
/// handling here and none is missing.
pub const
/// Which end of the rendering an affix operand is anchored to.
///
/// `sqlx`'s, with [`pattern`] below it: an affix is a `LIKE` pattern and nothing else in this crate
/// builds one. [`gcd`] above stays ungated because both citizens' `reduced` call it, which is a
/// domain answer rather than a lowering.
pub
/// One affix operand as a `LIKE` pattern, or the first character that disqualified it.
///
/// # The alphabet check is what removes the `ESCAPE` clause
///
/// A `num/den` rendering is two decimal integers and a slash, so its alphabet is `[0-9/]` and
/// `%`, `_` and `\` cannot occur in one. Refusing them here means no `LIKE` metacharacter can ever
/// reach a pattern, which is what lets both lowerings render a bare `LIKE ?` — the `ESCAPE` literal
/// being one of the few places the three dialects genuinely differ (`'\'` on Postgres, `'\\'` on
/// MySQL).
///
/// The refusal narrows nothing: an operand holding a character the rendering cannot produce names no
/// row either way. What it buys over silently matching nothing is that a client hears why.
///
/// It returns the CHARACTER rather than an error, because the error belongs to whichever citizen was
/// asked — a client filtering rates should not be told about timebases.
///
/// The wildcards are appended AFTER the check, so the two `%` this function writes are the only ones
/// a pattern can hold. The pattern is built INTO the carrier: capacity is exact — the operand plus at
/// most two wildcards — and `Utf8BytesMut` holds 23 bytes inline, which every pattern over this
/// alphabet that a real value could match is inside.
///
/// # Errors
///
/// The first character outside `[0-9/]`.
pub