aria_engine_core/
action.rs1use serde::{Deserialize, Serialize};
2
3#[derive(Debug, Clone, Copy, PartialEq, Eq, Hash, Serialize, Deserialize)]
8#[serde(rename_all = "snake_case")]
9pub enum Action {
10 OpticalStep,
12 Predict,
14 Match,
16 Diffuse,
18 Stutter,
20}
21
22impl Action {
23 pub const ALL: [Action; 5] = [
25 Action::OpticalStep,
26 Action::Predict,
27 Action::Match,
28 Action::Diffuse,
29 Action::Stutter,
30 ];
31
32 pub const PRODUCTIVE: [Action; 4] = [
34 Action::OpticalStep,
35 Action::Predict,
36 Action::Match,
37 Action::Diffuse,
38 ];
39
40 pub const PHI_CYCLE: [Action; 4] = [
42 Action::OpticalStep,
43 Action::Predict,
44 Action::Match,
45 Action::Diffuse,
46 ];
47
48 pub fn symbol(&self) -> &'static str {
50 match self {
51 Action::OpticalStep => "O",
52 Action::Predict => "P",
53 Action::Match => "M",
54 Action::Diffuse => "D",
55 Action::Stutter => "S",
56 }
57 }
58}
59
60#[cfg(test)]
61mod tests {
62 use super::*;
63
64 #[test]
65 fn action_has_exactly_five_variants() {
66 assert_eq!(Action::ALL.len(), 5);
68 assert_eq!(Action::PRODUCTIVE.len(), 4);
69 }
70}