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
//! Runtime mirror of the substrate contracts — `irregex/contract/engine.toml`,
//! `irregex/contract/analytic.toml`, and the kinship package's
//! `contract/kinship.toml` — plus the result records both planes report.
//!
//! Only those three, on purpose. A product's own contract is mirrored in that
//! product's crate: the exact face's published names and tool boundary live in
//! its own crate's `contract` module, beside the `contract/surface.toml` they
//! answer to. They were mirrored here while the packages shared a repository,
//! which left this crate's test suite unable to run without that face's
//! checkout next to it — a substrate its consumers cannot be released without.
//!
//! The package embeds the contracts' load-bearing constants so it carries no
//! runtime dependency on the repo files (an OSS checkout ships without them); the
//! crate's parity test reads the canonical TOML and asserts this mirror matches
//! it — the standard registry-as-contract shape, so the two cannot silently
//! drift from the engine.
//!
//! The analytic plane's row-schema table is not hand-mirrored at all: it is
//! lowered from `analytic.toml` into [`schema`] by
//! `irregex/tools/build_schema_tables.py`, and [`crate::runtime`] walks it to
//! decode every analytic row.
/// The generated `[row_schemas]` / `[row_enums]` / `[analytic.verbs]` tables.
///
/// The generator writes this file to the crate's `src/` root, so the module is
/// mounted here by path rather than living beside its siblings.
pub use ;
// ── `[meta]` in contract/engine.toml ─────────────────────────────────────
/// C-ABI compatibility integer (tracks `src/root.zig` `abi()`).
pub const ABI_VERSION: u32 = 2;
/// Engine semver. Read from this crate's own `Cargo.toml` rather than restated:
/// the binding ships out of the engine's repository and is released with it, so
/// the two versions are one number, and `Cargo.toml` is the only place in this
/// crate it is written. [`crate::engine_version`] reports what the linked
/// library actually says, and the contract parity test asserts the two agree.
pub const ENGINE_VERSION: &str = env!;
/// Mirrors `[request_options]` — the deep [`crate::SearchRequest`] surface. The
/// parity test asserts this set equals the TOML keys.
pub const REQUEST_OPTIONS: & = &;
/// Mirrors `[match_kinds]`.
pub const MATCH_KINDS: & = &;
// ── `[exit_codes]` — ripgrep's process codes, preserved end-to-end ─────────
/// At least one match.
pub const EXIT_MATCHED: i32 = 0;
/// Ran cleanly, found nothing.
pub const EXIT_NO_MATCH: i32 = 1;
/// Unsupported pattern/flag or an I/O/walk error — never a silent empty result.
pub const EXIT_ERROR: i32 = 2;
// ── `[status_codes]` — the in-process C-ABI return vocabulary ──────────────
// Declared by the engine (`irregex/contract/engine.toml`), which is what returns
// these. Deliberately NOT folded into the exit codes above: exit 1 is "no match"
// while status 1 is "match", so one merged table would be a live hazard.
// Mirrored here rather than in the FFI module so a subprocess-only build still
// carries the vocabulary its parity test checks.
/// Ran cleanly, no match.
pub const STATUS_OK: i32 = 0;
/// Ran cleanly, at least one match (or: a record/row was written).
pub const STATUS_MATCH: i32 = 1;
/// This tier declines — a **declinature**, not a failure. The caller answers
/// through the next tier down and gets the identical result, so no binding may
/// surface it as an error value.
pub const STATUS_STALE: i32 = -1;
/// Allocation failed (fault domain `resource`).
pub const STATUS_OOM: i32 = -2;
/// The warm corpus could not be stood up (`corpus` / `persist` / `wire`).
pub const STATUS_OPEN_FAILED: i32 = -3;
/// An unknown flag bit or a wrongly-sized request struct — fail-closed.
pub const STATUS_INVALID: i32 = -4;
// ── `[coordinate_spaces]` — which ruler a fault's `at` is measured in ───────
// Also the engine's table. A fault carries at most one offset, and its meaning
// used to be inferred from whether `path` was empty; the space is now stated.
/// No offset — the fault is about the file or the request as a whole.
pub const AT_NONE: i32 = 0;
/// A byte offset within the fault's `path`.
pub const AT_FILE: i32 = 1;
/// A byte offset within the pattern that was refused.
pub const AT_PATTERN: i32 = 2;
// ── result records ─────────────────────────────────────────────────────────
/// What a [`Match`] line is.
/// One matched span within a line: its `text` and byte offsets `[start, end)`.
/// One structured result line, as the engine's `--json` stream reports it.
// ── ranked view (`--rank`) ───────────────────────────────────────────────────
/// How the engine's `--rank` view classified a file — the property `grep` can't
/// express (`src/rank/signals.zig`), and the `rank_kind` row enum on the wire.
/// One row of the engine's `--rank` view: a file ranked definition-first by the
/// RRF kernel and tagged with the engine's own class. Schema `ranked` (id 22)
/// on the analytic plane; recovered from human stdout on the subprocess tier.