#[non_exhaustive]pub enum DurationType {
Show 17 variants
DuplexMaxima,
Maxima,
Longa,
Breve,
Whole,
Half,
Quarter,
Eighth,
Sixteenth,
ThirtySecond,
SixtyFourth,
HundredTwentyEighth,
TwoHundredFiftySixth,
FiveHundredTwelfth,
TenTwentyFourth,
TwentyFortyEighth,
Zero,
}Expand description
A note-value name, as music21’s duration.typeToDuration defines them.
Each type is a power-of-two multiple of a quarter note, from the
duplex-maxima (sixteen whole notes) down to the 2048th, plus the zero
length music21 uses for grace notes.
Variants (Non-exhaustive)§
This enum is marked as non-exhaustive
DuplexMaxima
Duplex maxima, sixteen whole notes.
Maxima
Maxima, eight whole notes.
Longa
Longa, four whole notes.
Breve
Breve, or double whole note.
Whole
Whole note.
Half
Half note.
Quarter
Quarter note.
Eighth
Eighth note.
Sixteenth
Sixteenth note.
ThirtySecond
Thirty-second note.
SixtyFourth
Sixty-fourth note.
HundredTwentyEighth
Hundred-twenty-eighth note.
TwoHundredFiftySixth
Two-hundred-fifty-sixth note.
FiveHundredTwelfth
Five-hundred-twelfth note.
TenTwentyFourth
Ten-twenty-fourth note.
TwentyFortyEighth
Twenty-forty-eighth note.
Zero
A grace-note duration of no length.
Implementations§
Source§impl DurationType
impl DurationType
Sourcepub const ALL: [DurationType; 17]
pub const ALL: [DurationType; 17]
Every duration type, longest first, matching music21’s ordering.
Sourcepub fn music21_name(self) -> &'static str
pub fn music21_name(self) -> &'static str
Returns the music21 type name, such as "whole" or "16th".
Sourcepub fn ordinal(self) -> Option<usize>
pub fn ordinal(self) -> Option<usize>
music21’s ordinal: the position in the list of note values from the
duplex maxima (0) down to the 2048th (15). None for Zero.
Sourcepub fn next_larger(self) -> Option<DurationType>
pub fn next_larger(self) -> Option<DurationType>
The next longer note value: music21’s nextLargerType, so a quarter
gives a half. None above the duplex maxima and for Zero.
Sourcepub fn next_smaller(self) -> Option<DurationType>
pub fn next_smaller(self) -> Option<DurationType>
The next shorter note value: music21’s nextSmallerType, so a quarter
gives an eighth. None below the 2048th and for Zero.
Sourcepub fn type_number(self) -> Option<FloatType>
pub fn type_number(self) -> Option<FloatType>
Returns music21’s type number: how many of this note value make a
whole note, so a quarter is 4 and a breve 0.5. None for Zero.
Sourcepub fn quarter_length(self) -> FloatType
pub fn quarter_length(self) -> FloatType
Returns the length of one undotted note of this type, in quarter lengths.
Sourcepub fn from_music21_name(name: &str) -> Option<Self>
pub fn from_music21_name(name: &str) -> Option<Self>
Parses a music21 type name.
Sourcepub fn from_quarter_length(quarter_length: FloatType) -> Option<Self>
pub fn from_quarter_length(quarter_length: FloatType) -> Option<Self>
Returns the type whose undotted length is exactly quarter_length.
Sourcepub fn quarter_length_with_dots(self, dots: u32) -> FloatType
pub fn quarter_length_with_dots(self, dots: u32) -> FloatType
Returns the length of this type carrying dots augmentation dots.
Each dot adds half of what came before, so a dotted half is 3.0 and a
double-dotted half is 3.5.
Trait Implementations§
Source§impl Clone for DurationType
impl Clone for DurationType
Source§fn clone(&self) -> DurationType
fn clone(&self) -> DurationType
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
source. Read moreimpl Copy for DurationType
Source§impl Debug for DurationType
impl Debug for DurationType
Source§impl<'de> Deserialize<'de> for DurationType
Available on crate feature serde only.
impl<'de> Deserialize<'de> for DurationType
serde only.Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Source§impl Display for DurationType
impl Display for DurationType
impl Eq for DurationType
Source§impl FromStr for DurationType
impl FromStr for DurationType
Source§impl Hash for DurationType
impl Hash for DurationType
Source§impl PartialEq for DurationType
impl PartialEq for DurationType
Source§impl Serialize for DurationType
Available on crate feature serde only.
impl Serialize for DurationType
serde only.impl StructuralPartialEq for DurationType
Auto Trait Implementations§
impl Freeze for DurationType
impl RefUnwindSafe for DurationType
impl Send for DurationType
impl Sync for DurationType
impl Unpin for DurationType
impl UnsafeUnpin for DurationType
impl UnwindSafe for DurationType
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> DeserializeOwned for Twhere
T: for<'de> Deserialize<'de>,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more