music21/braille/objects.rs
1//! Marks that help braille transcription and are not themselves written:
2//! music21's `braille.objects`.
3
4/// Where a braille segment divides: music21's `BrailleSegmentDivision` and
5/// `BrailleOptionalSegmentDivision`. Standing in a measure, it ends the
6/// segment there, in the middle of the measure if need be.
7///
8/// ```
9/// use music21::braille::SegmentDivision;
10///
11/// assert_eq!(SegmentDivision::Required.class_name(), "BrailleSegmentDivision");
12/// assert_eq!(
13/// SegmentDivision::Optional.class_name(),
14/// "BrailleOptionalSegmentDivision"
15/// );
16/// ```
17#[derive(Clone, Copy, Debug, PartialEq, Eq)]
18#[cfg_attr(feature = "serde", derive(serde::Serialize, serde::Deserialize))]
19pub enum SegmentDivision {
20 /// The segment divides here, unless it holds nothing yet.
21 Required,
22 /// The segment divides here only once it holds more than 48 elements.
23 Optional,
24}
25
26impl SegmentDivision {
27 /// music21's class name for it.
28 pub fn class_name(self) -> &'static str {
29 match self {
30 Self::Required => "BrailleSegmentDivision",
31 Self::Optional => "BrailleOptionalSegmentDivision",
32 }
33 }
34}