mingli_contract/
declare.rs1use serde::Serialize;
7
8
9#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize)]
11pub enum Family {
12 Cyclic,
14 Angular,
16 Sampling,
18 Hashing,
20 CrossCutting,
22}
23
24impl Family {
25 #[must_use]
27 pub fn label(self) -> &'static str {
28 match self {
29 Family::Cyclic => "循环群/CRT",
30 Family::Angular => "角度量化",
31 Family::Sampling => "抽样/二进制",
32 Family::Hashing => "哈希环",
33 Family::CrossCutting => "飞布/横切",
34 }
35 }
36}
37
38#[derive(Debug, Clone, Copy, PartialEq, Eq, Serialize)]
40pub enum Determinism {
41 Det,
43 Sto,
45 Und,
47}
48
49impl Determinism {
50 #[must_use]
52 pub fn label(self) -> &'static str {
53 match self {
54 Determinism::Det => "确定",
55 Determinism::Sto => "随机·种子可复现",
56 Determinism::Und => "欠定",
57 }
58 }
59}
60
61#[derive(Debug, Clone, Copy, Serialize)]
63pub struct DetItem {
64 pub aspect: &'static str,
66 pub status: Determinism,
68 pub note: &'static str,
70}
71
72#[must_use]
74pub const fn d(aspect: &'static str, status: Determinism, note: &'static str) -> DetItem {
75 DetItem { aspect, status, note }
76}
77
78#[derive(Debug, Clone, Copy, Serialize)]
80pub struct SchoolItem {
81 pub id: &'static str,
83 pub name: &'static str,
85 pub default: bool,
87 pub note: &'static str,
89}
90
91#[must_use]
93pub const fn s(id: &'static str, name: &'static str, default: bool, note: &'static str) -> SchoolItem {
94 SchoolItem { id, name, default, note }
95}