note_pen/
rest.rs

1use crate::duration::Duration;
2
3#[derive(Copy, Clone, Debug)]
4#[repr(transparent)]
5#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
6pub struct Rest(pub Duration);
7
8impl Rest {
9    #[inline]
10    pub const fn new(duration: Duration) -> Self {
11        Self(duration)
12    }
13
14    #[inline]
15    pub const fn duration(&self) -> Duration {
16        self.0
17    }
18}
19
20#[cfg(test)]
21mod tests {
22    use super::*;
23    use crate::duration::Duration;
24
25    #[test]
26    fn test_rest() {
27        let rest = Rest::new(Duration::WHOLE);
28        assert_eq!(rest.duration(), Duration::WHOLE);
29    }
30}