1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
use super::{DisplayOctave, DisplayStep};
use crate::datatypes::YesNo;
use musicxml_internal::*;
use musicxml_macros::*;

/// Attributes pertaining to the [Rest] element.
#[derive(Debug, Default, PartialEq, Eq, AttributeDeserialize, AttributeSerialize)]
pub struct RestAttributes {
  /// If yes, this indicates this is a complete measure rest.
  pub measure: Option<YesNo>,
}

/// Contents of the [Rest] element.
#[derive(Debug, PartialEq, Eq, ContentDeserialize, ContentSerialize)]
pub struct RestContents {
  /// The [DisplayStep] element specifies the step of the rest.
  pub display_step: Option<DisplayStep>,
  /// The [DisplayOctave] element specifies the octave of the rest.
  pub display_octave: Option<DisplayOctave>,
}

/// The [Rest] element indicates notated rests or silences.
///
/// A [Rest] element is usually empty, but placement on the staff can be specified using [DisplayStep] and [DisplayOctave] elements.
#[derive(Debug, PartialEq, Eq, ElementDeserialize, ElementSerialize)]
pub struct Rest {
  /// Element-specific attributes
  pub attributes: RestAttributes,
  #[flatten]
  /// Element-specific content
  pub content: RestContents,
}