Skip to main content

MidiDataError

Enum MidiDataError 

Source
pub enum MidiDataError {
Show 19 variants OutOfRange, NotAByte, Unterminated, TooLarge, Negative(i128), NotInList(i128), NotChannelVoice(u8), DataTooLarge { message: u8, byte: u8, }, UnknownEventType(u8), MissingParameters, IncorrectData, UnwrittenType, NotATrack, NotAFile(Vec<u8>), BadHeaderLength, UnreadFormat(u64), TicksPerFrame(u64), UnwrittenDivision, BadChannel(i64),
}
Expand description

What goes wrong with MIDI’s bytes, in music21’s words.

Variants§

§

OutOfRange

The bytes ran out where more were needed: Python’s IndexError.

§

NotAByte

A byte value outside a byte: Python’s ValueError from bytes.

§

Unterminated

No end was found to a variable-length number.

§

TooLarge

A variable-length number past what 64 bits hold.

§

Negative(i128)

A negative number, which has no variable-length form.

§

NotInList(i128)

A number past a byte, to be written as one.

§

NotChannelVoice(u8)

A status nibble that is no channel message.

§

DataTooLarge

A program change or channel pressure past 127; the message is the status nibble’s.

Fields

§message: u8

The status nibble.

§byte: u8

The byte after it.

§

UnknownEventType(u8)

A status byte that starts no event music21 reads.

§

MissingParameters

A channel message written without both its parameters.

§

IncorrectData

A channel message’s data neither a byte nor bytes.

§

UnwrittenType

An event of no type that is written.

§

NotATrack

A track chunk without its tag.

§

NotAFile(Vec<u8>)

Bytes that do not start with FILE_HEADER; the first twenty.

§

BadHeaderLength

A file header of other than six bytes.

§

UnreadFormat(u64)

A file of format 2, whose tracks are separate pieces.

§

TicksPerFrame(u64)

SMPTE time of a frame rate MIDI does not have.

§

UnwrittenDivision

Ticks to a quarter note too many for the header to hold.

§

BadChannel(i64)

A channel other than 1 to 16.

Trait Implementations§

Source§

impl Clone for MidiDataError

Source§

fn clone(&self) -> Self

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 Debug for MidiDataError

Source§

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

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

impl Display for MidiDataError

Source§

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

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

impl Eq for MidiDataError

Source§

impl Error for MidiDataError

1.30.0 · Source§

fn source(&self) -> Option<&(dyn Error + 'static)>

Returns the lower-level source of this error, if any. Read more
1.0.0 · Source§

fn description(&self) -> &str

👎Deprecated since 1.42.0:

use the Display impl or to_string()

1.0.0 · Source§

fn cause(&self) -> Option<&dyn Error>

👎Deprecated since 1.33.0:

replaced by Error::source, which can support downcasting

Replaced by Error::source.
Source§

fn provide<'a>(&'a self, request: &mut Request<'a>)

🔬This is a nightly-only experimental API. (error_generic_member_access)
Provides type-based access to context intended for error reports. Read more
Source§

impl PartialEq for MidiDataError

Source§

fn eq(&self, other: &Self) -> 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 MidiDataError

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 = !

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.