euphony_core/time/measure.rs
1use crate::time::{beat::Beat, time_signature::TimeSignature};
2
3new_ratio!(Measure, u64);
4
5impl Measure {
6 pub fn count(self) -> u64 {
7 self.whole()
8 }
9
10 pub fn beat(self) -> Beat {
11 self.as_ratio().fraction().into()
12 }
13}
14
15impl core::ops::Mul<TimeSignature> for Measure {
16 type Output = Beat;
17
18 fn mul(self, time_signature: TimeSignature) -> Self::Output {
19 time_signature * self
20 }
21}