pub struct Note { /* private fields */ }Expand description
A pitched note.
Implementations§
Source§impl Note
impl Note
Sourcepub fn from_name(name: impl Into<String>) -> Result<Self>
pub fn from_name(name: impl Into<String>) -> Result<Self>
Builds a note from a pitch name such as "C#4" or "E-".
Sourcepub fn from_pitch(pitch: Pitch) -> Result<Self>
pub fn from_pitch(pitch: Pitch) -> Result<Self>
Builds a note from an existing Pitch.
Sourcepub fn pitch_name(&self) -> String
pub fn pitch_name(&self) -> String
Returns the pitch name without an octave, such as "C#" or "E-".
Sourcepub fn pitch_name_with_octave(&self) -> String
pub fn pitch_name_with_octave(&self) -> String
Returns the pitch name with an octave when one is set.
Sourcepub fn duration(&self) -> Option<&Duration>
pub fn duration(&self) -> Option<&Duration>
Returns the note duration when one has been assigned.
Sourcepub fn set_duration(&mut self, duration: Duration)
pub fn set_duration(&mut self, duration: Duration)
Assigns a duration to the note.
Sourcepub fn with_duration(self, duration: Duration) -> Self
pub fn with_duration(self, duration: Duration) -> Self
Returns a copy of this note with the supplied duration.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Note
impl<'de> Deserialize<'de> for Note
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>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl From<Note> for StreamElement
impl From<Note> for StreamElement
Source§impl IntoNote for &Note
impl IntoNote for &Note
Source§fn try_into_note(self) -> Result<Note>
fn try_into_note(self) -> Result<Note>
Converts the value into a note.
Source§const FROM_INTEGER_PITCH: bool = false
const FROM_INTEGER_PITCH: bool = false
Whether this value came from an integer pitch class or MIDI-like number.
Source§impl IntoNote for Note
impl IntoNote for Note
Source§fn try_into_note(self) -> Result<Note>
fn try_into_note(self) -> Result<Note>
Converts the value into a note.
Source§const FROM_INTEGER_PITCH: bool = false
const FROM_INTEGER_PITCH: bool = false
Whether this value came from an integer pitch class or MIDI-like number.
Auto Trait Implementations§
impl Freeze for Note
impl RefUnwindSafe for Note
impl Send for Note
impl Sync for Note
impl Unpin for Note
impl UnsafeUnpin for Note
impl UnwindSafe for Note
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