Struct musical_note::NotesMap

source ·
pub struct NotesMap { /* private fields */ }
Expand description

Effectively maps notes to midi and backwards.

Example

use musical_note::{NotesMap, NoteName, Accidental};
let map = NotesMap::get();
assert_eq!(map.get_by_note(NoteName::F, Accidental::DoubleFlat), 3);

Implementations

Accidental of “root” is not counted.

For the given note and MIDI-byte finds only possible enharmonic variant, or returns None.

For example: with the given NoteName::C and midi 2, only possible enharmonic variant is (NoteName::C, Accidental::DoubleSharp), which will be returned.

If None is returned — something goes very wrong and it is better to panic.

Trait Implementations

Formats the value using the given formatter. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more
Immutably borrows from an owned value. Read more
Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

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

The type returned in the event of a conversion error.
Performs the conversion.
The type returned in the event of a conversion error.
Performs the conversion.