Skip to main content

NamedTemperament

Struct NamedTemperament 

Source
pub struct NamedTemperament {
    pub name: &'static str,
    pub page: &'static str,
    pub revision: u64,
    pub subgroup: &'static [IntegerType],
    pub periods_per_equave: UnsignedIntegerType,
    pub generator_rows: &'static [&'static [IntegerType]],
    pub generator_ratios: &'static [&'static str],
    pub generator_cents: &'static [FloatType],
    pub optimization: &'static str,
    pub titles: &'static str,
    pub commas: &'static [&'static str],
    pub moments: &'static [&'static str],
}
Expand description

A regular temperament the Xenharmonic Wiki names and publishes a mapping for.

This is the published description; NamedTemperament::temperament turns it into a crate::tuningsystem::Temperament that can answer questions.

No Eq or Hash: a generator is a width in cents, and a float is not a thing to compare exactly or to key a map by.

Fields§

§name: &'static str

The name it goes by.

§page: &'static str

The wiki page it was read from.

§revision: u64

The revision of that page, so a later collection can diff.

§subgroup: &'static [IntegerType]

The primes it is written over; the first is the equave.

§periods_per_equave: UnsignedIntegerType

How many periods there are to an equave.

§generator_rows: &'static [&'static [IntegerType]]

One row per generator, over the primes after the equave.

§generator_ratios: &'static [&'static str]

Each generator written as the ratio it approximates.

§generator_cents: &'static [FloatType]

Each generator’s width in cents, under optimization.

§optimization: &'static str

Which optimum those widths are.

§titles: &'static str

The infobox’s own Title, empty unless the page names more than one temperament.

The constant is named after the page, not after this: which of several names goes with which of the subgroups a page lists is not something the infobox states, so it is recorded here rather than guessed at.

§commas: &'static [&'static str]

The commas it tempers out, as the wiki lists them.

§moments: &'static [&'static str]

The moment-of-symmetry scales the wiki lists for it, if any.

Empty above rank 2: a moment of symmetry comes of stacking one generator, and a rank-3 temperament has two.

Implementations§

Source§

impl NamedTemperament

Source

pub fn temperament(&self) -> Result<Temperament>

Builds the temperament this entry describes.

Errors where Temperament::from_mapping_rows does, which for a collected entry means the wiki’s generators and its mapping disagree — a mistranscription, or a page that has changed under us.

Source§

impl NamedTemperament

Source

pub const fn rank(&self) -> usize

How many rows the mapping has: one for the period, one per generator.

Source

pub const fn equave(&self) -> IntegerType

The prime it repeats at — 2 for an octave, 3 for a tritave.

Trait Implementations§

Source§

impl Clone for NamedTemperament

Source§

fn clone(&self) -> NamedTemperament

Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§

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

Performs copy-assignment from source. Read more
Source§

impl Copy for NamedTemperament

Source§

impl Debug for NamedTemperament

Source§

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

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

impl PartialEq for NamedTemperament

Source§

fn eq(&self, other: &NamedTemperament) -> bool

Equality operator ==. Read more
1.0.0 (const: unstable) · Source§

fn ne(&self, other: &Rhs) -> bool

Inequality operator !=. Read more
Source§

impl StructuralPartialEq for NamedTemperament

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, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = !

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

fn try_from(value: U) -> Result<T, !>

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.