vyre_spec/layer.rs
1//! Frozen conformance-layer tags used by operation metadata.
2
3/// Conformance layer declared by operation metadata in the frozen contract.
4///
5/// Example: `Layer::L2` records that an operation belongs to the byte-oriented
6/// library-operation layer.
7#[derive(Debug, Clone, PartialEq, Eq, Hash, serde::Deserialize, serde::Serialize)]
8#[non_exhaustive]
9pub enum Layer {
10 /// L0: published wire-format and data-model contracts.
11 L0,
12 /// L1: primitive scalar and bit-level operations.
13 L1,
14 /// L2: byte-oriented library operations.
15 L2,
16 /// L3: structured algorithms and graph-like operations.
17 L3,
18 /// L4: mutation-gated composition surfaces.
19 L4,
20 /// L5: adversarial and stability-hardened operations.
21 L5,
22}
23
24impl Layer {
25 /// Stable layer identifier for generated documentation.
26 #[must_use]
27 pub const fn id(&self) -> &'static str {
28 match self {
29 Self::L0 => "L0",
30 Self::L1 => "L1",
31 Self::L2 => "L2",
32 Self::L3 => "L3",
33 Self::L4 => "L4",
34 Self::L5 => "L5",
35 }
36 }
37
38 /// Human-readable layer description for generated documentation.
39 #[must_use]
40 pub const fn layer_description(&self) -> &'static str {
41 match self {
42 Self::L0 => "Wire-format and data-model contracts",
43 Self::L1 => "Primitive scalar and bit-level operations",
44 Self::L2 => "Byte-oriented library operations",
45 Self::L3 => "Structured algorithms and graph-like operations",
46 Self::L4 => "Mutation-gated composition surfaces",
47 Self::L5 => "Adversarial and stability-hardened operations",
48 }
49 }
50}