added from_u8 to effects enum

This commit is contained in:
vextrixes committed 2026-07-03 16:53:30 +02:00
1 parent f46c4a81a6
commit b2ed013452
1 file changed
+26
+26
View File
@@ -54,4 +54,30 @@ impl Effects {
StaticPerKey => 20, StaticPerKey => 20,
} }
} }
pub fn from_u8(n: u8) -> Option<Self> {
match n {
1 => Some(Static),
2 => Some(SingleOn),
3 => Some(SingleOff),
4 => Some(Glittering),
5 => Some(Rain),
6 => Some(Colorful),
7 => Some(Breath),
8 => Some(Spectrum),
9 => Some(CentrifugalWave),
10 => Some(VerticalWave),
11 => Some(HorizontalWave),
12 => Some(Rotating),
13 => Some(Explosion),
14 => Some(Launch),
15 => Some(Ripples),
16 => Some(Snake),
17 => Some(Pulse),
18 => Some(Tilt),
19 => Some(Shuttle),
20 => Some(StaticPerKey),
_ => None
}
}
} }