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
//! [`BarcodeDetection<T>`](BarcodeDetection): a machine-readable code that was DECODED, and which
//! standard it was read under.

use core::fmt;

use smol_bytes::Utf8Bytes;

use crate::{
  BoundingBox, BoundingBoxFilter, BoundingBoxLeaf, ColumnEq, ColumnKind, ColumnName, ColumnShape,
  CompositeFilterMarker, CompositeMarker, ConfidenceFilter, DefaultMarker, DefaultVecMarker,
  EnumFilter, FieldName, OrderLevel, PayloadFilter, QuantifiedMarker, Score, TextFilter, shape,
};

use super::{Symbology, detection::CONFIDENCE, located::BBOX};

#[cfg(test)]
mod tests;

/// **A DECODED CODE**, the standard it was read under, and where on the frame it was.
///
/// # The payload is a PAYLOAD, on [`TextDetection<T>`](super::TextDetection)'s terms
///
/// What a code carries is its own content, read back, and not a class a model chose — so there is no
/// [`Label`](super::Label) here and the door refuses nothing. A decoder that read a code carrying an
/// empty payload has made an observation; the symbology and the region are what a caller is asking
/// about anyway.
///
/// # What this type ADDS beside the payload is the SYMBOLOGY, and the two are filtered UNALIKE
///
/// A [`Symbology`] is a closed-ish VOCABULARY where a payload is free text, so one takes the
/// membership operators and the other the affix family. `contains: "qr"` over a symbology would
/// match `micro_qr` for a reason that is about spelling rather than about standards; `contains:
/// "https://"` over a payload is *does this code carry a link*, which is exactly what people ask.
/// See [`BarcodeDetectionFilter`], where both halves are argued.
///
/// # THE BOX IS REQUIRED and the type is GENERIC over its component, as everywhere in this house
///
/// A decoded code has a place it was decoded from, and there is no `Option` here. `T` is what the
/// box is measured in; the confidence names [`Score`] rather than taking a width, which is
/// [`Detection`](super::Detection)'s own ruling.
///
/// # Examples
///
/// ```
/// use ingraph::{BarcodeDetection, BoundingBox, Score, Symbology};
///
/// let ticket = BarcodeDetection::new(
///   "M1DOE/JOHN            EABC123 LHRJFKBA",
///   Symbology::Pdf417,
///   Score::new(0.98).unwrap(),
///   BoundingBox::try_unit(0.05, 0.60, 0.90, 0.20).unwrap(),
/// );
///
/// assert_eq!(ticket.symbology(), &Symbology::Pdf417);
/// assert!(ticket.payload().starts_with("M1DOE"));
/// ```
#[derive(Clone, PartialEq, Eq, Hash)]
pub struct BarcodeDetection<T> {
  pub(super) payload: Utf8Bytes,
  pub(super) symbology: Symbology,
  pub(super) confidence: Score,
  pub(super) bbox: BoundingBox<T>,
}

impl<T> BarcodeDetection<T> {
  /// A decoded code, in the region it was read from.
  ///
  /// INFALLIBLE: a [`Score`] cannot exist outside `[0.0, 1.0]`, a [`Symbology`] is total over every
  /// word, the box's rules are its own, and a payload has no rule at all.
  #[inline]
  #[must_use]
  pub fn new(
    payload: impl Into<Utf8Bytes>,
    symbology: Symbology,
    confidence: Score,
    bbox: BoundingBox<T>,
  ) -> Self {
    Self {
      payload: payload.into(),
      symbology,
      confidence,
      bbox,
    }
  }

  /// What the code carried.
  #[inline]
  #[must_use]
  pub fn payload(&self) -> &str {
    self.payload.as_str()
  }

  /// The payload as the crate's own text carrier — what a column binds.
  #[inline]
  #[must_use]
  pub const fn payload_bytes(&self) -> &Utf8Bytes {
    &self.payload
  }

  /// Which barcode standard it was read under.
  #[inline]
  #[must_use]
  pub const fn symbology(&self) -> &Symbology {
    &self.symbology
  }

  /// How confident the decoder was, in `[0.0, 1.0]`.
  #[inline]
  #[must_use]
  pub const fn confidence(&self) -> Score {
    self.confidence
  }

  /// The region the code was read from.
  #[inline]
  #[must_use]
  pub const fn bbox(&self) -> &BoundingBox<T> {
    &self.bbox
  }
}

impl<T: fmt::Debug> fmt::Debug for BarcodeDetection<T> {
  fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
    f.debug_struct("BarcodeDetection")
      .field("payload", &self.payload.as_str())
      .field("symbology", &self.symbology)
      .field("confidence", &self.confidence.get())
      .field("bbox", &self.bbox)
      .finish()
  }
}

/// The decoded content's segment.
pub(super) const PAYLOAD: &FieldName = FieldName::new("payload");

/// The standard's segment.
pub(super) const SYMBOLOGY: &FieldName = FieldName::new("symbology");

/// **The EIGHT columns a decoded code spans**: the payload, the standard, the confidence, and the
/// box's five under its own name.
impl<T: ColumnKind> ColumnKind for BarcodeDetection<T> {
  const SEGMENTS: &'static [ColumnShape] = &[
    ColumnShape::Plain(ColumnName::of(PAYLOAD)),
    ColumnShape::Plain(ColumnName::of(SYMBOLOGY)),
    ColumnShape::Plain(ColumnName::of(CONFIDENCE)),
    shape::<BoundingBox<T>>(ColumnName::of(BBOX)),
  ];

  const ORDER: &'static [OrderLevel] = ORDER;
}

/// A decoded code is one column value when its payload, its standard, its confidence and its
/// region all are — the region through its own row, so the box's derived area plays no part in
/// what the box itself compares equal.
impl<T: ColumnEq> ColumnEq for BarcodeDetection<T> {
  #[inline]
  fn column_eq(&self, other: &Self) -> bool {
    self.payload_bytes().column_eq(other.payload_bytes())
      && self.symbology().column_eq(other.symbology())
      && self.confidence().column_eq(&other.confidence())
      && self.bbox().column_eq(other.bbox())
  }
}

/// **The order those eight columns MEAN, and the box's derived leaf is in NO level of it.**
///
/// Seven levels over eight leaves, in declaration order. The eighth is the box's `area`, and this
/// citizen owes the sequence rather than the leaf — the rule
/// [`LocatedDetection<T>`](super::LocatedDetection) is the first case of, read at a third holder.
pub(super) const ORDER: &[OrderLevel] = &[
  OrderLevel::new(0),
  OrderLevel::new(1),
  OrderLevel::new(2),
  OrderLevel::new(3),
  OrderLevel::new(4),
  OrderLevel::new(5),
  OrderLevel::new(6),
];

/// **The VALUE one of a decoded code's seven levels compares.**
#[derive(Debug, Clone, PartialEq, Eq, Hash)]
pub enum BarcodeDetectionLeaf<T> {
  /// Leaf `0` — what the code carried.
  Payload(Utf8Bytes),
  /// Leaf `1` — the standard it was read under.
  Symbology(Symbology),
  /// Leaf `2` — how sure the decoder was.
  Confidence(Score),
  /// Leaves `3`–`6` — the rectangle's own, under the box's numbering shifted by the three above.
  Bbox(BoundingBoxLeaf<T>),
}

/// One leaf is the same as another leaf when it is the SAME leaf holding the same value — never
/// across kinds, so a payload is never equal to a symbology even where both happen to compare
/// true against another value of their own kind.
impl<T: ColumnEq> ColumnEq for BarcodeDetectionLeaf<T> {
  fn column_eq(&self, other: &Self) -> bool {
    match (self, other) {
      (Self::Payload(this), Self::Payload(that)) => this.column_eq(that),
      (Self::Symbology(this), Self::Symbology(that)) => this.column_eq(that),
      (Self::Confidence(this), Self::Confidence(that)) => this.column_eq(that),
      (Self::Bbox(this), Self::Bbox(that)) => this.column_eq(that),
      _ => false,
    }
  }
}

/// **The seven VALUE leaves, the geometry's four delegated, and [`None`] for the derived eighth.**
impl<T: ColumnKind + Copy> crate::OrderLeaves for BarcodeDetection<T> {
  type Leaf = BarcodeDetectionLeaf<T>;

  fn leaf(&self, at: usize) -> Option<BarcodeDetectionLeaf<T>> {
    match at {
      0 => Some(BarcodeDetectionLeaf::Payload(self.payload.clone())),
      1 => Some(BarcodeDetectionLeaf::Symbology(self.symbology.clone())),
      2 => Some(BarcodeDetectionLeaf::Confidence(self.confidence)),
      3..=7 => crate::OrderLeaves::leaf(&self.bbox, at - 3).map(BarcodeDetectionLeaf::Bbox),
      _ => None,
    }
  }
}

/// **The KEYSET position of ONE leaf**: which leaf, then that leaf's own bytes.
impl<T: crate::CursorValue> crate::CursorValue for BarcodeDetectionLeaf<T> {
  fn write_cursor(&self, out: &mut Vec<u8>) {
    match self {
      Self::Payload(payload) => {
        out.push(0);
        crate::CursorValue::write_cursor(payload, out);
      }
      Self::Symbology(symbology) => {
        out.push(1);
        crate::CursorValue::write_cursor(symbology, out);
      }
      Self::Confidence(confidence) => {
        out.push(2);
        crate::CursorValue::write_cursor(confidence, out);
      }
      Self::Bbox(leaf) => {
        out.push(3);
        crate::CursorValue::write_cursor(leaf, out);
      }
    }
  }

  fn read_cursor(bytes: &[u8]) -> Option<Self> {
    let (tag, value) = bytes.split_first()?;
    match tag {
      0 => <Utf8Bytes as crate::CursorValue>::read_cursor(value).map(Self::Payload),
      1 => <Symbology as crate::CursorValue>::read_cursor(value).map(Self::Symbology),
      2 => <Score as crate::CursorValue>::read_cursor(value).map(Self::Confidence),
      3 => <BoundingBoxLeaf<T> as crate::CursorValue>::read_cursor(value).map(Self::Bbox),
      _ => None,
    }
  }
}

/// **ONE BIND OUT**, through the row the leaf's own type already had.
#[cfg(feature = "sqlx")]
impl<Db, T> crate::Carrier<Db> for BarcodeDetectionLeaf<T>
where
  Db: sqlx::Database,
  Utf8Bytes: crate::Carrier<Db>,
  Symbology: crate::Carrier<Db>,
  Score: crate::Carrier<Db>,
  BoundingBoxLeaf<T>: crate::Carrier<Db>,
{
  fn push_bind(&self, qb: &mut sqlx::QueryBuilder<Db>) {
    match self {
      Self::Payload(payload) => <Utf8Bytes as crate::Carrier<Db>>::push_bind(payload, qb),
      Self::Symbology(symbology) => <Symbology as crate::Carrier<Db>>::push_bind(symbology, qb),
      Self::Confidence(confidence) => <Score as crate::Carrier<Db>>::push_bind(confidence, qb),
      Self::Bbox(leaf) => <BoundingBoxLeaf<T> as crate::Carrier<Db>>::push_bind(leaf, qb),
    }
  }
}

/// **The DECLARED half — EIGHT words**: the payload's text, the symbology's text, the confidence's,
/// and the box's five read off its own row.
impl<Db, T> crate::StoredAs<Db> for BarcodeDetection<T>
where
  Utf8Bytes: crate::StoredAs<Db>,
  Symbology: crate::StoredAs<Db>,
  Score: crate::StoredAs<Db>,
  BoundingBox<T>: crate::StoredAs<Db>,
{
  const WORDS: &'static [&'static str] = &[
    <Utf8Bytes as crate::StoredAs<Db>>::WORDS[0],
    <Symbology as crate::StoredAs<Db>>::WORDS[0],
    <Score as crate::StoredAs<Db>>::WORDS[0],
    <BoundingBox<T> as crate::StoredAs<Db>>::WORDS[0],
    <BoundingBox<T> as crate::StoredAs<Db>>::WORDS[1],
    <BoundingBox<T> as crate::StoredAs<Db>>::WORDS[2],
    <BoundingBox<T> as crate::StoredAs<Db>>::WORDS[3],
    <BoundingBox<T> as crate::StoredAs<Db>>::WORDS[4],
  ];
}

/// **THE ADMISSION**, DELEGATED to the geometry half — a frame carrying several codes is
/// `Vec<BarcodeDetection<NormCoord>>`.
impl<T: crate::CollectionElement> crate::CollectionElement for BarcodeDetection<T> {}

/// **EIGHT BINDS OUT**, and SEVEN for a structural judgment.
#[cfg(feature = "sqlx")]
impl<Db, T> crate::Carrier<Db> for BarcodeDetection<T>
where
  Db: sqlx::Database,
  Utf8Bytes: crate::Carrier<Db>,
  Symbology: crate::Carrier<Db>,
  Score: crate::Carrier<Db>,
  BoundingBox<T>: crate::Carrier<Db>,
{
  fn push_bind(&self, qb: &mut sqlx::QueryBuilder<Db>) {
    self.push_leading(qb);
    <BoundingBox<T> as crate::Carrier<Db>>::push_bind(&self.bbox, qb);
  }

  fn push_value_bind(&self, qb: &mut sqlx::QueryBuilder<Db>) {
    self.push_leading(qb);
    <BoundingBox<T> as crate::Carrier<Db>>::push_value_bind(&self.bbox, qb);
  }
}

#[cfg(feature = "sqlx")]
impl<T> BarcodeDetection<T> {
  /// The THREE binds this level owns, written once and spent by both of the carrier's faces — the
  /// half that is the same whichever width the box contributes.
  fn push_leading<Db>(&self, qb: &mut sqlx::QueryBuilder<Db>)
  where
    Db: sqlx::Database,
    Utf8Bytes: crate::Carrier<Db>,
    Symbology: crate::Carrier<Db>,
    Score: crate::Carrier<Db>,
  {
    <Utf8Bytes as crate::Carrier<Db>>::push_bind(&self.payload, qb);
    qb.push(", ");
    <Symbology as crate::Carrier<Db>>::push_bind(&self.symbology, qb);
    qb.push(", ");
    <Score as crate::Carrier<Db>>::push_bind(&self.confidence, qb);
    qb.push(", ");
  }
}

/// **AND THE VALUE COLUMNS BACK IN**, by name.
///
/// The symbology's read CANONICALISES rather than refusing — see [`Symbology`], where the openness
/// is argued — so a stored `DATA-MATRIX` written by hand comes back as the named member. That is the
/// one column here whose decode is not the identity, and it is a canonicalisation rather than a
/// second authority: the word it hands back is the word the next write would bind.
#[cfg(feature = "sqlx")]
impl<'a, R, T> crate::Assemble<'a, R> for BarcodeDetection<T>
where
  R: sqlx::Row,
  Utf8Bytes: crate::Assemble<'a, R>,
  Symbology: crate::Assemble<'a, R>,
  Score: crate::Assemble<'a, R>,
  BoundingBox<T>: crate::Assemble<'a, R>,
{
  fn assemble(row: &'a R, under: Option<&crate::Path<'_>>) -> sqlx::Result<Self> {
    let payload: Utf8Bytes = crate::assembled(row, PAYLOAD, under)?;
    let symbology: Symbology = crate::assembled(row, SYMBOLOGY, under)?;
    let confidence: Score = crate::assembled(row, CONFIDENCE, under)?;
    let bbox: BoundingBox<T> = crate::assembled(row, BBOX, under)?;

    Ok(Self::new(payload, symbology, confidence, bbox))
  }
}

/// **THE KEYSET POSITION** — the four members in segment order, each behind its own four-byte
/// length, for [`TextDetection<T>`](super::TextDetection)'s reason: two of the four are
/// variable-width and the first of them is FIRST.
impl<T: crate::CursorValue> crate::CursorValue for BarcodeDetection<T> {
  fn write_cursor(&self, out: &mut Vec<u8>) {
    crate::cursor::write_member(&self.payload, out);
    crate::cursor::write_member(&self.symbology, out);
    crate::cursor::write_member(&self.confidence, out);
    crate::cursor::write_member(&self.bbox, out);
  }

  fn read_cursor(bytes: &[u8]) -> Option<Self> {
    let mut rest = bytes;
    let payload = crate::cursor::read_member::<Utf8Bytes>(&mut rest)?;
    let symbology = crate::cursor::read_member::<Symbology>(&mut rest)?;
    let confidence = crate::cursor::read_member::<Score>(&mut rest)?;
    let bbox = crate::cursor::read_member::<BoundingBox<T>>(&mut rest)?;

    rest
      .is_empty()
      .then(|| Self::new(payload, symbology, confidence, bbox))
  }
}

/// What guards a [`BarcodeDetection<T>`] column — its own filter at both seats.
impl<T> CompositeFilterMarker for BarcodeDetection<T>
where
  T: DefaultMarker,
{
  type Filter = BarcodeDetectionFilter<PayloadFilter<T>>;
  type ColumnFilter = BarcodeDetectionFilter<PayloadFilter<T>>;
}

/// The interpretation a [`BarcodeDetection<T>`] field is read under — the COMPOSITE reading.
impl<T: DefaultMarker> DefaultMarker for BarcodeDetection<T> {
  type Marker = CompositeMarker<BarcodeDetection<T>>;
}

/// **A COLLECTION of decoded codes is asked through the QUANTIFIERS alone.**
///
/// `any` carries the whole [`BarcodeDetectionFilter`], so *a QR code carrying a link was decoded
/// confidently* is ONE element question — which is the shape that matters and the one a per-column
/// reading could never state, the standard and the payload otherwise being answered by two
/// different codes in one frame.
impl<T: DefaultMarker> DefaultVecMarker for BarcodeDetection<T> {
  type Marker = QuantifiedMarker<Vec<BarcodeDetection<T>>>;
}

/// The filter that guards a [`BarcodeDetection<T>`] column: the payload, the standard, the
/// confidence and the region.
///
/// ```text
/// input BarcodeDetectionF32Filter {
///   payload: TextFilter   symbology: SymbologyEnumFilter
///   confidence: ConfidenceFilter
///   bbox: BoundingBoxF32Filter
/// }
/// ```
///
/// # THE TWO TEXT-SHAPED FACETS PART COMPANY, and that is this face's own sentence
///
/// **The symbology is an [`EnumFilter`] and the payload is a [`TextFilter`].** A symbology is a
/// VOCABULARY — membership is the whole question, and `contains: "qr"` would match `micro_qr` for a
/// reason that is about spelling rather than about standards. A payload is FREE TEXT, so the affix
/// family is exactly right: *does this code carry a URL* is a substring question, and it is the one
/// people ask.
///
/// The symbology's `notIn` is where the open escape earns its keep on the wire: *a code read under
/// something this roster does not name* is a question no closed enum could express, there being
/// nothing outside it. See [`Symbology`], where the openness is argued.
///
/// # NO WHOLE-CODE OPERATOR
///
/// None of `eq`, `ne`, `in` or an ordering, on the house's shared terms. The AREA facet arrives with
/// the box and needs no line here.
pub struct BarcodeDetectionFilter<CF> {
  pub(super) payload: Option<TextFilter<Utf8Bytes>>,
  pub(super) symbology: Option<EnumFilter<Symbology>>,
  pub(super) confidence: Option<ConfidenceFilter>,
  pub(super) bbox: Option<BoundingBoxFilter<CF>>,
}

impl<CF> BarcodeDetectionFilter<CF> {
  /// The empty filter — no facet set, so a column guarded by it is unconstrained.
  #[inline]
  #[must_use]
  pub const fn new() -> Self {
    Self {
      payload: None,
      symbology: None,
      confidence: None,
      bbox: None,
    }
  }

  crate::graphql::filter::opt_accessor!(
    payload: TextFilter<Utf8Bytes> => with_payload, set_payload, maybe_payload, update_payload
  );
  crate::graphql::filter::opt_accessor!(
    symbology: EnumFilter<Symbology> => with_symbology, set_symbology, maybe_symbology, update_symbology
  );
  crate::graphql::filter::opt_accessor!(
    confidence: ConfidenceFilter => with_confidence, set_confidence, maybe_confidence, update_confidence
  );
  crate::graphql::filter::opt_accessor!(
    bbox: BoundingBoxFilter<CF> => with_bbox, set_bbox, maybe_bbox, update_bbox
  );
}

impl<CF: crate::GraphqlFilter> BarcodeDetectionFilter<CF> {
  /// True while NO operator slot is set on ANY of the four facets.
  pub fn is_empty(&self) -> bool {
    self
      .payload
      .as_ref()
      .is_none_or(crate::GraphqlFilter::is_empty)
      && self.symbology.as_ref().is_none_or(EnumFilter::is_empty)
      && self
        .confidence
        .as_ref()
        .is_none_or(ConfidenceFilter::is_empty)
      && self
        .bbox
        .as_ref()
        .is_none_or(crate::GraphqlFilter::is_empty)
  }
}

impl<CF: crate::GraphqlFilter> crate::GraphqlFilter for BarcodeDetectionFilter<CF> {
  #[inline]
  fn is_empty(&self) -> bool {
    Self::is_empty(self)
  }
}

impl<CF> Default for BarcodeDetectionFilter<CF> {
  #[inline]
  fn default() -> Self {
    Self::new()
  }
}

impl<CF: fmt::Debug> fmt::Debug for BarcodeDetectionFilter<CF> {
  fn fmt(&self, f: &mut fmt::Formatter<'_>) -> fmt::Result {
    f.debug_struct("BarcodeDetectionFilter")
      .field("payload", &self.payload)
      .field("symbology", &self.symbology)
      .field("confidence", &self.confidence)
      .field("bbox", &self.bbox)
      .finish()
  }
}

impl<CF: Clone> Clone for BarcodeDetectionFilter<CF> {
  fn clone(&self) -> Self {
    Self {
      payload: self.payload.clone(),
      symbology: self.symbology.clone(),
      confidence: self.confidence.clone(),
      bbox: self.bbox.clone(),
    }
  }
}

impl<CF: PartialEq> PartialEq for BarcodeDetectionFilter<CF> {
  fn eq(&self, other: &Self) -> bool {
    self.payload == other.payload
      && self.symbology == other.symbology
      && self.confidence == other.confidence
      && self.bbox == other.bbox
  }
}