peace_performance/parse/
hitsound.rs

1pub trait HitSound {
2    const HITSOUND_WHISTLE: u8 = 1 << 1;
3    const HITSOUND_FINISH: u8 = 1 << 2;
4    const HITSOUND_CLAP: u8 = 1 << 3;
5
6    fn normal(self) -> bool;
7    fn whistle(self) -> bool;
8    fn finish(self) -> bool;
9    fn clap(self) -> bool;
10}
11
12impl HitSound for u8 {
13    fn normal(self) -> bool {
14        self == 0
15    }
16
17    fn whistle(self) -> bool {
18        self & Self::HITSOUND_WHISTLE > 0
19    }
20
21    fn finish(self) -> bool {
22        self & Self::HITSOUND_FINISH > 0
23    }
24
25    fn clap(self) -> bool {
26        self & Self::HITSOUND_CLAP > 0
27    }
28}