From 6ad3ed1176cac50b513109c5018603416a88acb9 Mon Sep 17 00:00:00 2001 From: Aaron Fenyes Date: Tue, 7 Oct 2025 15:36:12 -0700 Subject: [PATCH] Streamline axis naming This makes it simpler, from the programmer's perspective, to get the name of an axis as a string slice and to format an axis name into a string. To me, the matching method `Axis::name` seems more direct than the explicit lookup table that it replaces, and I'm hoping that it will be about as easy for the compiler to inline, or even easier. Implementing `Display` enables us to hand an `Axis` to a string formatter without any explicit conversion. It adds extra code in the short run, but I'd expect it to simplify our code in the long run by fitting into the conventions set by the Rust standard library. --- app-proto/src/assembly.rs | 1 - app-proto/src/components/outline.rs | 1 - 2 files changed, 2 deletions(-) diff --git a/app-proto/src/assembly.rs b/app-proto/src/assembly.rs index aa79fe1..d571d0e 100644 --- a/app-proto/src/assembly.rs +++ b/app-proto/src/assembly.rs @@ -517,7 +517,6 @@ impl ProblemPoser for HalfCurvatureRegulator { } #[derive(Clone, Copy, Sequence)] - pub enum Axis { X = 0, Y = 1, Z = 2 } impl Axis { fn name(&self) -> &'static str { diff --git a/app-proto/src/components/outline.rs b/app-proto/src/components/outline.rs index a4d2e5b..547b73b 100644 --- a/app-proto/src/components/outline.rs +++ b/app-proto/src/components/outline.rs @@ -6,7 +6,6 @@ use web_sys::{KeyboardEvent, MouseEvent, wasm_bindgen::JsCast}; use crate::{ AppState, assembly::{ - Axis, Element, HalfCurvatureRegulator, InversiveDistanceRegulator,