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
//! Field-signature helpers for schema minimization (and isomorphism).
//! Ported from `~/dev/omnist/omnist/ops/signature.py`.
//!
//! [`local_signature`] is the target-blind structural key used as the
//! *initial* partition for `minimize`'s partition refinement: a key
//! including ref target names would be too strong a starting point --
//! records that turn out to be equivalent because their ref targets are
//! themselves equivalent-but-differently-named would never even land in
//! the same starting block. It captures a field's label, cardinality, and
//! scalar-or-ref *shape*, but excludes ref target names (those are compared
//! by evolving block id during `minimize`'s refinement instead).
use crate;
/// A field's target-blind shape: `Scalar(kind, nullable)`, `Ref` (the
/// target record's name is deliberately excluded -- see the module doc
/// comment), or `Any`.
/// One field's signature entry: `(label, min, max, shape)`.
pub type FieldKey = ;
/// A record's target-blind structural key: every field's [`FieldKey`],
/// sorted by label.
pub type LocalSignature = ;
/// Target-blind structural key for a record: fields sorted by label, each
/// keyed by `(label, min, max, shape)`.
///
/// Fields are sorted by label rather than kept in declaration order:
/// validation ignores field order (a `Record` is a *set* of labeled fields),
/// so two records that declare the same fields in a different order accept
/// exactly the same documents and MUST land in the same initial partition
/// block -- keying by declaration order would incorrectly split them.