pub enum Text {
Utf8(String),
Other(Vec<u8>),
}
Expand description
The MIDI spec does not state what encoding should be used for strings. Since Rust strings are
UTF-8 encoded, we try to parse text as a String
and hope for the best. But if we get an error
then we store the original bytes to facilitate lossless parsing.
Variants§
Utf8(String)
A UTF-8 encoded string.
Other(Vec<u8>)
Some bytes that we don’t understand, probably a string in some non-UTF-8 encoding.
Implementations§
Trait Implementations§
source§impl Ord for Text
impl Ord for Text
source§impl PartialEq for Text
impl PartialEq for Text
source§impl PartialOrd for Text
impl PartialOrd for Text
1.0.0 · source§fn le(&self, other: &Rhs) -> bool
fn le(&self, other: &Rhs) -> bool
This method tests less than or equal to (for
self
and other
) and is used by the <=
operator. Read moreimpl Eq for Text
impl StructuralEq for Text
impl StructuralPartialEq for Text
Auto Trait Implementations§
impl RefUnwindSafe for Text
impl Send for Text
impl Sync for Text
impl Unpin for Text
impl UnwindSafe for Text
Blanket Implementations§
source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere T: ?Sized,
source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more