musicxml/datatypes/semitones.rs
1use alloc::string::{String, ToString};
2use core::ops::Deref;
3use musicxml_internal::{DatatypeDeserializer, DatatypeSerializer};
4use musicxml_macros::{DatatypeDeserialize, DatatypeSerialize};
5
6/// Represents semitones, used for chromatic alteration.
7///
8/// A value of -1 corresponds to a flat and a value of 1 to a sharp.
9/// Decimal values like 0.5 (quarter tone sharp) are used for microtones.
10///
11/// The value of an instance of this type may be accessed by dereferencing the struct: `*datatype_val`.
12#[derive(Debug, PartialEq, Eq, DatatypeDeserialize, DatatypeSerialize)]
13pub struct Semitones(pub i16);
14
15impl Deref for Semitones {
16  type Target = i16;
17  fn deref(&self) -> &Self::Target {
18    &self.0
19  }
20}