euv_core/dynamic/contract/struct.rs
1use super::*;
2
3/// Strongly-typed logical instance slot identifier (locates a slot without inferring interface types).
4#[derive(
5 Clone, Data, Debug, Default, Deserialize, Eq, Hash, New, Ord, PartialEq, PartialOrd, Serialize,
6)]
7pub struct SlotKey {
8 /// Logical slot identifier (e.g. `"product-card"`).
9 pub(crate) key: String,
10}
11
12/// Structured compile-time component interface identity (`package:interface/vN`).
13#[derive(
14 Clone, Data, Debug, Default, Deserialize, Eq, Hash, New, Ord, PartialEq, PartialOrd, Serialize,
15)]
16pub struct ComponentInterfaceId {
17 /// Canonical WIT / contract interface identifier string.
18 pub(crate) id: String,
19 /// Interface major version number.
20 #[get(type(copy))]
21 pub(crate) version: u32,
22}
23
24/// Reference strongly-typed Props struct for `ProductCardContract` (Sec 11.9).
25#[derive(Clone, Data, Debug, Default, Deserialize, Eq, Hash, New, PartialEq, Serialize)]
26pub struct ProductCardProps {
27 /// Stable business product identifier.
28 pub(crate) product_id: String,
29 /// Current authoritative order quantity.
30 #[get(type(copy))]
31 pub(crate) quantity: u32,
32}
33
34/// Zero-sized contract marker type binding `ProductCardProps` and `ProductCardEvent` at compile time.
35#[derive(Clone, Copy, Debug, Default, Eq, Hash, PartialEq)]
36pub struct ProductCardContract;
37
38/// Snapshot of dynamic boundary activity counters verifying zero dynamic calls during steady-state rendering.
39#[derive(Clone, Copy, Data, Debug, Default, Eq, Hash, New, PartialEq)]
40pub struct DynamicFrameMetrics {
41 /// Total dynamic Wasm or declarative module invocations performed.
42 #[get(type(copy))]
43 pub(crate) dynamic_module_calls: u64,
44 /// Total cross-boundary Props/Event serializations performed.
45 #[get(type(copy))]
46 pub(crate) boundary_serializations: u64,
47 /// Total manifest or slot-binding lookups performed.
48 #[get(type(copy))]
49 pub(crate) manifest_lookups: u64,
50}
51
52/// Resolved binding descriptor attaching a strongly-typed contract slot to a pinned implementation.
53#[derive(Clone, Data, Debug, Eq, New, PartialEq)]
54pub struct ResolvedContractBinding {
55 /// Normalized route owning this binding.
56 pub(crate) route: String,
57 /// Logical slot key within the route.
58 pub(crate) slot_key: SlotKey,
59 /// Active pinned release generation identifier.
60 #[get(type(copy))]
61 pub(crate) generation_id: u64,
62 /// Compile-time interface identifier verified against the artifact.
63 pub(crate) interface_id: String,
64 /// Interface major version verified against the artifact.
65 #[get(type(copy))]
66 pub(crate) interface_version: u32,
67 /// Local UI state schema version declared by the active artifact.
68 #[get(type(copy))]
69 pub(crate) state_schema_version: u32,
70 /// Backing execution mode and content address.
71 pub(crate) source: DynamicBindingSource,
72}