pub const COMPACT_SURFACE_TOOL_COUNT: usize = 3;
pub const COMPACT_TOOL_NAMES: [&str; COMPACT_SURFACE_TOOL_COUNT] =
["symforge", "symforge_edit", "status"];
#[derive(Clone, Copy, Debug, Eq, PartialEq)]
pub enum CompactSurfaceTool {
Symforge,
SymforgeEdit,
Status,
}
impl CompactSurfaceTool {
pub const ALL: [Self; COMPACT_SURFACE_TOOL_COUNT] =
[Self::Symforge, Self::SymforgeEdit, Self::Status];
pub const fn as_str(self) -> &'static str {
match self {
Self::Symforge => "symforge",
Self::SymforgeEdit => "symforge_edit",
Self::Status => "status",
}
}
}
#[derive(Debug, Clone, Copy, PartialEq, Eq)]
pub enum SurfaceProfile {
Full,
Compact,
Meta,
}
pub fn surface_profile_label(profile: SurfaceProfile) -> &'static str {
match profile {
SurfaceProfile::Full => "full",
SurfaceProfile::Meta => "meta",
SurfaceProfile::Compact => "compact",
}
}
pub fn surface_label_from_str(value: &str) -> Option<&'static str> {
surface_profile_from_label(value).map(surface_profile_label)
}
pub fn surface_profile_from_label(value: &str) -> Option<SurfaceProfile> {
match value {
"full" => Some(SurfaceProfile::Full),
"meta" => Some(SurfaceProfile::Meta),
"compact" => Some(SurfaceProfile::Compact),
_ => None,
}
}
#[cfg(test)]
mod tests {
use super::*;
#[test]
fn compact_tool_names_match_a019_registry() {
let from_enum: Vec<&str> = CompactSurfaceTool::ALL.iter().map(|t| t.as_str()).collect();
assert_eq!(from_enum.as_slice(), COMPACT_TOOL_NAMES);
}
}