1#[derive(Debug, Clone, Copy, PartialEq, Eq)]
5pub enum OperationMode {
6 Normal,
7 Plan,
8}
9
10impl std::fmt::Display for OperationMode {
11 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
12 match self {
13 Self::Normal => write!(f, "Normal"),
14 Self::Plan => write!(f, "Plan"),
15 }
16 }
17}
18
19impl OperationMode {
20 pub fn from_str_loose(s: &str) -> Option<Self> {
22 match s.to_lowercase().as_str() {
23 "normal" => Some(Self::Normal),
24 "plan" => Some(Self::Plan),
25 _ => None,
26 }
27 }
28}
29
30#[derive(Debug, Clone, Copy, PartialEq, Eq)]
32pub enum AutonomyLevel {
33 Manual,
34 SemiAuto,
35 Auto,
36}
37
38impl std::fmt::Display for AutonomyLevel {
39 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
40 match self {
41 Self::Manual => write!(f, "Manual"),
42 Self::SemiAuto => write!(f, "Semi-Auto"),
43 Self::Auto => write!(f, "Auto"),
44 }
45 }
46}
47
48impl AutonomyLevel {
49 pub fn from_str_loose(s: &str) -> Option<Self> {
51 match s.to_lowercase().as_str() {
52 "manual" => Some(Self::Manual),
53 "semi-auto" | "semiauto" | "semi" => Some(Self::SemiAuto),
54 "auto" | "full" => Some(Self::Auto),
55 _ => None,
56 }
57 }
58}
59
60#[derive(Debug, Clone, Copy, PartialEq, Eq)]
62pub enum ReasoningLevel {
63 Off,
64 Low,
65 Medium,
66 High,
67}
68
69impl std::fmt::Display for ReasoningLevel {
70 fn fmt(&self, f: &mut std::fmt::Formatter<'_>) -> std::fmt::Result {
71 match self {
72 Self::Off => write!(f, "Off"),
73 Self::Low => write!(f, "Low"),
74 Self::Medium => write!(f, "Medium"),
75 Self::High => write!(f, "High"),
76 }
77 }
78}
79
80impl ReasoningLevel {
81 pub fn from_str_loose(s: &str) -> Self {
83 match s.to_lowercase().as_str() {
84 "off" | "none" => Self::Off,
85 "low" => Self::Low,
86 "high" => Self::High,
87 _ => Self::Medium,
88 }
89 }
90
91 pub fn to_config_string(&self) -> Option<String> {
93 match self {
94 Self::Off => None,
95 Self::Low => Some("low".to_string()),
96 Self::Medium => Some("medium".to_string()),
97 Self::High => Some("high".to_string()),
98 }
99 }
100
101 pub fn next(self) -> Self {
103 match self {
104 Self::Off => Self::Low,
105 Self::Low => Self::Medium,
106 Self::Medium => Self::High,
107 Self::High => Self::Off,
108 }
109 }
110}
111
112#[cfg(test)]
113#[path = "enums_tests.rs"]
114mod tests;