#[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 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 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§fn eq(&self, other: &DurationType) -> bool
fn eq(&self, other: &DurationType) -> bool
self and other values to be equal, and is used by ==.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,
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