no num_enum

This commit is contained in:
galister 2026-07-12 16:58:29 +09:00
parent c3cbc43f6f
commit 62c210fc1d
3 changed files with 3 additions and 6 deletions

1
Cargo.lock generated
View File

@ -6603,7 +6603,6 @@ dependencies = [
"image",
"log",
"lru",
"num_enum",
"ouroboros",
"parking_lot",
"regex",

View File

@ -36,7 +36,6 @@ image = {
]
}
lru = "0.18.0"
num_enum = "0.7.6" # for converting integers into Option enums (search for TryFromPrimitive in the codebase)
ouroboros = "0.18.5"
parking_lot = "0.12.5"
resvg = { version = "0.47.0", default-features = false }

View File

@ -1,10 +1,9 @@
use crate::drawing;
use num_enum::TryFromPrimitive;
use strum::EnumCount;
use strum::{EnumCount, VariantArray};
// Primary: button color
// OnPrimary: text color placed on the Primary-colored button
#[derive(Debug, Copy, Clone, TryFromPrimitive, EnumCount)]
#[derive(Debug, Copy, Clone, EnumCount, VariantArray)]
#[repr(u8)]
pub enum WguiColorName {
Primary,
@ -78,7 +77,7 @@ impl WguiColorPalette {
fn resolve_name(&self, in_name: &str) -> Option<WguiColorName> {
for (idx, (_, name)) in self.colors.iter().enumerate() {
if in_name == *name {
return WguiColorName::try_from(idx as u8).ok();
return WguiColorName::VARIANTS.get(idx).copied();
}
}
None