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
//! Type-level tagging for HList items and compile-time type equality.
//!
//! [`Tagged`] wraps a value with a phantom tag type, enabling lookup by tag rather than
//! position in an HList. This is the core mechanism for capability registries, template
//! pages, route tags, and plugin state.
//!
//! # Examples
//!
//! ```rust
//! use lariv_rs::tag::Tagged;
//!
//! struct UsersTag;
//! let state = Tagged::<UsersTag, _>::new(42);
//! assert_eq!(state.value, 42);
//! ```
use PhantomData;
/// Phantom-tag wrapper associating a value with a compile-time tag type.
///
/// Used throughout lariv-rs for capability outputs, template markers, route tags,
/// and plugin state. The tag type carries no runtime data.
///
/// # Use cases
///
/// - Mounted capability values keyed by plugin tag (e.g. `Tagged<UsersTag, UsersState>`)
/// - Template page registration in an HList
/// - Route URL builders keyed by route tag types
///
/// # Examples
///
/// ```rust
/// use lariv_rs::tag::Tagged;
///
/// struct MyTag;
/// let tagged = Tagged::<MyTag, &str>::new("hello");
/// assert_eq!(tagged.value, "hello");
/// ```
/// Witness that two types are the same (see [`CompileEq`]).
;
/// Witness that two types differ (see [`CompileEq`]).
;
pub use CompileEqResult;
/// Compile-time type equality probe.
///
/// - `T: CompileEq<T, TypesEq>` always holds.
/// - `T: CompileEq<U, TypesNotEq>` holds for any `T`, `U` (including `T == U`).
///
/// Leaving the result parameter inferred is unambiguous only when the types
/// differ; when they are equal both results apply and inference fails. That is
/// the usual way to require inequality in where-clauses.
///
/// # Use cases
///
/// - [`crate::traits::add::CapTagAbsent`] — prove a capability tag is not already present
/// - Preventing duplicate plugin tags at compile time