pub struct Duration { /* private fields */ }Expand description
Rhythmic duration measured in quarter lengths.
A quarter note has a quarter length of 1.0; an eighth note is 0.5;
a whole note is 4.0.
Implementations§
Source§impl Duration
impl Duration
Sourcepub fn new(quarter_length: FloatType) -> Result<Self>
pub fn new(quarter_length: FloatType) -> Result<Self>
Creates a duration from a quarter-length value.
Sourcepub fn from_type(duration_type: DurationType) -> Self
pub fn from_type(duration_type: DurationType) -> Self
Creates a duration from a note-value type.
Sourcepub fn from_type_with_dots(duration_type: DurationType, dots: u32) -> Self
pub fn from_type_with_dots(duration_type: DurationType, dots: u32) -> Self
Creates a duration from a note-value type carrying augmentation dots.
Sourcepub fn duration_type(&self) -> Option<DurationType>
pub fn duration_type(&self) -> Option<DurationType>
Returns the note-value type whose undotted length this duration is.
Returns None for a length that is not a plain note value, such as a
dotted or tuplet duration.
Sourcepub fn quarter_length(&self) -> FloatType
pub fn quarter_length(&self) -> FloatType
Returns the duration in quarter lengths.
Sourcepub fn set_quarter_length(&mut self, quarter_length: FloatType) -> Result<()>
pub fn set_quarter_length(&mut self, quarter_length: FloatType) -> Result<()>
Updates the duration in quarter lengths.
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Duration
impl RefUnwindSafe for Duration
impl Send for Duration
impl Sync for Duration
impl Unpin for Duration
impl UnsafeUnpin for Duration
impl UnwindSafe for Duration
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
Mutably borrows from an owned value. Read more
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>
Converts
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>
Converts
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