pub enum Triads {
Major = 0,
Minor = 1,
Augmented = 2,
Diminished = 3,
}Expand description
The Triads implementation enumerates the allowed triad classifications determined
by the intervals between the chord factors.
Variants§
Implementations§
Source§impl Triads
impl Triads
Sourcepub const fn is_augmented(&self) -> bool
pub const fn is_augmented(&self) -> bool
Returns true if the enum is Triads::Augmented otherwise false
Sourcepub const fn is_diminished(&self) -> bool
pub const fn is_diminished(&self) -> bool
Returns true if the enum is Triads::Diminished otherwise false
Source§impl Triads
impl Triads
pub fn from_class<C>(class: C) -> Selfwhere
C: TriadType,
pub fn is<T: TriadType>(&self, class: T) -> bool
Sourcepub const fn diminished() -> Self
pub const fn diminished() -> Self
a functional constructor for the Diminished variant
Sourcepub fn try_from_notes(a: isize, b: isize, c: isize) -> Result<Self, TriadError>
pub fn try_from_notes(a: isize, b: isize, c: isize) -> Result<Self, TriadError>
try to derive a classification for a triad from three notes
Sourcepub fn try_from_arr(notes: [isize; 3]) -> Result<Self, TriadError>
pub fn try_from_arr(notes: [isize; 3]) -> Result<Self, TriadError>
try to determine the class of a triad from an array of three notes
Sourcepub const fn relative(&self) -> Self
pub const fn relative(&self) -> Self
returns the class relative to the current variant; for major and minor triads its rather straightforward
Sourcepub const fn intervals(&self) -> [usize; 3]
pub const fn intervals(&self) -> [usize; 3]
returns the intervals corresponding to the triad type as arrays of three usize values
ordered as: [root_to_third, root_to_fifth, third_to_fifth]
Sourcepub const fn thirds(&self) -> (usize, usize)
pub const fn thirds(&self) -> (usize, usize)
returns the two third intervals defining the current variant
Sourcepub const fn root(&self) -> usize
pub const fn root(&self) -> usize
returns the interval between the root and third chord factors
Sourcepub const fn root_ref(&self) -> &usize
pub const fn root_ref(&self) -> &usize
returns a reference to the interval between the root and third chord factors
Sourcepub const fn third(&self) -> usize
pub const fn third(&self) -> usize
returns the interval between the third and fifth chord factors
Sourcepub const fn third_ref(&self) -> &usize
pub const fn third_ref(&self) -> &usize
returns a reference to the interval between the third and fifth chord factors
Sourcepub const fn fifth(&self) -> usize
pub const fn fifth(&self) -> usize
returns the interval between the root and fifth chord factors
Sourcepub const fn fifth_ref(&self) -> &usize
pub const fn fifth_ref(&self) -> &usize
returns a reference to the interval between the root and fifth chord factors
Sourcepub fn is_valid(&self, root: usize, third: usize, fifth: usize) -> bool
pub fn is_valid(&self, root: usize, third: usize, fifth: usize) -> bool
returns true if the given chord factors satisfy the requirements of the current class
Trait Implementations§
Source§impl From<Diminished> for Triads
impl From<Diminished> for Triads
Source§fn from(_value: Diminished) -> Self
fn from(_value: Diminished) -> Self
Source§impl IntoEnumIterator for Triads
impl IntoEnumIterator for Triads
type Iterator = TriadsIter
fn iter() -> TriadsIter ⓘ
Source§impl Ord for Triads
impl Ord for Triads
Source§impl PartialOrd for Triads
impl PartialOrd for Triads
Source§impl TriadType for Triads
impl TriadType for Triads
Source§impl TryFrom<Triads> for Diminished
impl TryFrom<Triads> for Diminished
Source§impl VariantNames for Triads
impl VariantNames for Triads
impl Copy for Triads
impl Eq for Triads
Auto Trait Implementations§
impl Freeze for Triads
impl RefUnwindSafe for Triads
impl Send for Triads
impl Sync for Triads
impl Unpin for Triads
impl UnwindSafe for Triads
Blanket Implementations§
Source§impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
impl<T> AsWeight<T> for Twhere
T: Clone + IntoWeight<T>,
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<Q, K> Comparable<K> for Q
impl<Q, K> Comparable<K> for Q
Source§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
Source§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.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