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
//! Typed const-constructable handles into an ontology corpus.
//!
//! [`EntityRef`] is the build-time→runtime handle emitted by codegen and
//! consumed by ontology `from_codegen` functors. The phantom marker `P`
//! tags each handle with the ontology it belongs to, so handles from
//! different ontologies are distinct types at compile time but compile
//! to the same machine code (a single `u64`).
//!
//! Literature: typed-handle pattern is the standard way to express
//! ontology-distinct identity at the type level — see Spivak (2014)
//! *Category Theory for the Sciences* §3.1 on typed morphisms, and the
//! `Reference<N>` pattern already in pr4xis-domains.
use PhantomData;
/// Typed const-constructable handle into an ontology corpus.
///
/// Phantom marker `P` distinguishes handles per ontology — `EntityRef<English>`
/// and `EntityRef<UsCode>` are distinct types at compile time but compile to
/// the same machine code (a single u64). Const-constructable so it can appear
/// directly inside `&'static [(EntityRef<P>, EntityRef<P>)]` static arrays
/// emitted by codegen.
///
/// Literature: typed-handle pattern is the standard way to express
/// ontology-distinct identity at the type level — see Spivak (2014)
/// *Category Theory for the Sciences* §3.1 on typed morphisms, and the
/// `Reference<N>` pattern already in pr4xis-domains.
// Manual impls so the trait bounds don't transitively require `P: Trait`.
// `PhantomData<P>` itself implements Copy/Clone/PartialEq/Eq/Hash
// unconditionally, but deriving on the outer struct would force `P` to
// satisfy each trait too. The marker `P` is purely a tag; never inspected.