Enum tune::scala::KbmBuildError[][src]

pub enum KbmBuildError {
    FormalOctaveMissing,
    MappingTooLarge,
}

Error reported when building a Kbm fails.

Variants

FormalOctaveMissing

No formal octave parameter has been set.

The formal octave parameter is mandatory if at least one key is pushed.

Examples

// No key pushed. The mapping is linear and the formal octave parameter is optional.
let optional = Kbm::builder(Note::from_midi_number(0));
assert!(optional.build().is_ok());

// At least one key pushed. The formal octave parameter is mandatory.
let mandatory = Kbm::builder(Note::from_midi_number(0)).push_mapped_key(0);
assert_eq!(mandatory.build().unwrap_err(), KbmBuildError::FormalOctaveMissing);
MappingTooLarge

There are too many items in this mapping.

// The number of items is below the threshold.
let mut below = Kbm::builder(Note::from_midi_number(62)).formal_octave(0);
for _ in 0..65535 {
    below = below.push_mapped_key(0);
}
assert!(below.build().is_ok());

// The number of items is above the threshold.
let mut above = Kbm::builder(Note::from_midi_number(62)).formal_octave(0);
for _ in 0..65536 {
    above = above.push_mapped_key(0);
}
assert_eq!(above.build().unwrap_err(), KbmBuildError::MappingTooLarge);

Trait Implementations

impl Clone for KbmBuildError[src]

impl Debug for KbmBuildError[src]

impl Eq for KbmBuildError[src]

impl From<KbmBuildError> for KbmImportError[src]

impl PartialEq<KbmBuildError> for KbmBuildError[src]

impl StructuralEq for KbmBuildError[src]

impl StructuralPartialEq for KbmBuildError[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

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

The type returned in the event of a conversion error.