Skip to main content

RomanNumeral

Struct RomanNumeral 

Source
pub struct RomanNumeral { /* private fields */ }
Expand description

A parsed Roman numeral in a key.

Implementations§

Source§

impl RomanNumeral

Source

pub fn new(figure: impl Into<String>, key: Key) -> Result<Self>

Parses a Roman numeral figure in a key.

Supports ordinary figures such as V7/V and augmented-sixth figures such as It+6, Fr+6, Ger+6, and Sw+6.

Source

pub fn figure(&self) -> &str

Returns the original figure.

Source

pub fn degree(&self) -> u8

Returns the one-based scale degree.

Source

pub fn accidental(&self) -> i8

Returns the chromatic alteration of the scale degree in semitones.

Negative values are flats and positive values are sharps, so bII returns -1 and #iv returns 1.

Source

pub fn inversion(&self) -> u8

Returns the inversion number, where root position is 0.

Source

pub fn secondary(&self) -> Option<&str>

Returns the secondary/applied target figure, if any.

Source

pub fn key(&self) -> &Key

Returns the key context.

Source

pub fn to_chord(&self) -> Result<Chord>

Realizes the Roman numeral as a chord.

Source

pub fn analyze(chord: &Chord, key: Key) -> Result<Option<Self>>

Performs functional Roman-numeral analysis in a key.

Source

pub fn analyze_with_root( chord: &Chord, key: Key, root: &Pitch, ) -> Result<Option<Self>>

Performs Roman-numeral analysis using an explicit harmonic root.

This is useful for pitch-class-set browser views where the caller has already chosen a transposition root and does not want inversion or root inference to pick a different chord member.

Trait Implementations§

Source§

impl Clone for RomanNumeral

Source§

fn clone(&self) -> RomanNumeral

Returns a duplicate of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl Debug for RomanNumeral

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl Display for RomanNumeral

Source§

fn fmt(&self, formatter: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more

Auto Trait Implementations§

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

Source§

impl<T> IntoEither for T

Source§

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 more
Source§

fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
where F: FnOnce(&Self) -> bool,

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
Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

Creates owned data from borrowed data, usually by cloning. Read more
Source§

fn clone_into(&self, target: &mut T)

Uses borrowed data to replace owned data, usually by cloning. Read more
Source§

impl<T> ToString for T
where T: Display + ?Sized,

Source§

fn to_string(&self) -> String

Converts the given value to a String. Read more
Source§

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.