Struct music_theory::theory::enharmonic_note::EnharmonicNote
source · pub struct EnharmonicNote { /* private fields */ }
Expand description
An enhamonic note is a note that takes into account the enharmonic spelling.
Example:
use music_theory::theory::*;
let en = EnharmonicNote::wrap((Letter::A, Interval::SHARP)).unwrap();
assert_eq!(en.unwrap(), (Letter::A, Interval::SHARP));
Implementations§
source§impl EnharmonicNote
impl EnharmonicNote
sourcepub fn spelled_as(&self, letter: Letter) -> Self
pub fn spelled_as(&self, letter: Letter) -> Self
Spell an enharmonic note as an enharmonic note with a different base note but with the same note value.
Example:
use music_theory::theory::*;
let en = EnharmonicNote::wrap((Letter::A, Interval::ROOT)).unwrap();
let respelled = en.spelled_as(Letter::B);
assert_eq!(en.to_pc().to_note(), Note::ZERO);
assert_eq!(respelled.to_pc().to_note(), Note::ZERO);
assert_eq!(respelled.unwrap(), (Letter::B, Interval::FLAT2));
Trait Implementations§
source§impl Clone for EnharmonicNote
impl Clone for EnharmonicNote
source§fn clone(&self) -> EnharmonicNote
fn clone(&self) -> EnharmonicNote
Returns a copy of the value. Read more
1.0.0 · source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moresource§impl Cyclic for EnharmonicNote
impl Cyclic for EnharmonicNote
source§impl Debug for EnharmonicNote
impl Debug for EnharmonicNote
source§impl Display for EnharmonicNote
impl Display for EnharmonicNote
source§impl Hash for EnharmonicNote
impl Hash for EnharmonicNote
source§impl Ord for EnharmonicNote
impl Ord for EnharmonicNote
source§fn cmp(&self, other: &EnharmonicNote) -> Ordering
fn cmp(&self, other: &EnharmonicNote) -> Ordering
1.21.0 · source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere Self: Sized,
Compares and returns the maximum of two values. Read more
source§impl PartialEq<EnharmonicNote> for EnharmonicNote
impl PartialEq<EnharmonicNote> for EnharmonicNote
source§fn eq(&self, other: &EnharmonicNote) -> bool
fn eq(&self, other: &EnharmonicNote) -> bool
This method tests for
self
and other
values to be equal, and is used
by ==
.source§impl PartialOrd<EnharmonicNote> for EnharmonicNote
impl PartialOrd<EnharmonicNote> for EnharmonicNote
source§fn partial_cmp(&self, other: &EnharmonicNote) -> Option<Ordering>
fn partial_cmp(&self, other: &EnharmonicNote) -> Option<Ordering>
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moresource§impl Wrapper for EnharmonicNote
impl Wrapper for EnharmonicNote
impl Copy for EnharmonicNote
impl Eq for EnharmonicNote
impl StructuralEq for EnharmonicNote
impl StructuralPartialEq for EnharmonicNote
Auto Trait Implementations§
impl RefUnwindSafe for EnharmonicNote
impl Send for EnharmonicNote
impl Sync for EnharmonicNote
impl Unpin for EnharmonicNote
impl UnwindSafe for EnharmonicNote
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