pub struct KeySignature {
pub fifths: i8,
pub mode: String,
}Fields§
§fifths: i8-7 (7 flats) to +7 (7 sharps), 0 = C major / A minor.
mode: String“major” or “minor”
Implementations§
Source§impl KeySignature
impl KeySignature
Sourcepub fn alter_for_step(&self, step: &Step) -> i8
pub fn alter_for_step(&self, step: &Step) -> i8
Accidental alter (-1, 0, or +1) applied to step in this key signature.
Sourcepub fn contains_pitch(&self, pitch: &Pitch) -> bool
pub fn contains_pitch(&self, pitch: &Pitch) -> bool
True if pitch is diatonic to this key (octave-independent, checks step + alter).
Sourcepub fn tonic(&self) -> (Step, i8)
pub fn tonic(&self) -> (Step, i8)
Tonic step and alter for this key.
Examples: G major → (Step::G, 0), Bb major → (Step::B, -1), F# minor → (Step::F, 1).
Sourcepub fn display_name(&self) -> String
pub fn display_name(&self) -> String
Human-readable key name: "C major", "G major", "F# minor", "Bb major" etc.
Trait Implementations§
Source§impl Clone for KeySignature
impl Clone for KeySignature
Source§fn clone(&self) -> KeySignature
fn clone(&self) -> KeySignature
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for KeySignature
impl Debug for KeySignature
Source§impl Default for KeySignature
impl Default for KeySignature
Source§impl<'de> Deserialize<'de> for KeySignature
impl<'de> Deserialize<'de> for KeySignature
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 PartialEq for KeySignature
impl PartialEq for KeySignature
Source§impl Serialize for KeySignature
impl Serialize for KeySignature
impl StructuralPartialEq for KeySignature
Auto Trait Implementations§
impl Freeze for KeySignature
impl RefUnwindSafe for KeySignature
impl Send for KeySignature
impl Sync for KeySignature
impl Unpin for KeySignature
impl UnsafeUnpin for KeySignature
impl UnwindSafe for KeySignature
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