diff --git a/CHANGELOG.md b/CHANGELOG.md index dcb9afa..8119835 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -56,6 +56,7 @@ This release focuses on: - `UsbMidiEventPacket::from_midi` function, use `Message::into_packet` instead. - `CodeIndexNumber::find_from_message` function, use `Message::code_index_number` instead. - `From for U4` implementation. +- `From for U4` implementation. ## [0.3.0] - 2024-05-27 diff --git a/src/message/mod.rs b/src/message/mod.rs index 10c46dc..f0fae94 100644 --- a/src/message/mod.rs +++ b/src/message/mod.rs @@ -5,7 +5,6 @@ pub mod control_function; pub mod notes; pub mod raw; -use crate::data::u4::U4; use crate::data::u7::U7; use crate::data::FromClamped; use crate::message::channel::Channel; @@ -149,7 +148,7 @@ impl TryFrom<&UsbMidiEventPacket> for Message { impl Message { /// Create a packet from the message. pub fn into_packet(self, cable: CableNumber) -> UsbMidiEventPacket { - let cin = u8::from(U4::from(self.code_index_number())); + let cin = self.code_index_number() as u8; let mut raw = [0; 4]; raw[0] = (cable as u8) << 4 | cin; diff --git a/src/packet/code_index_number.rs b/src/packet/code_index_number.rs index 6cb7fbf..39871de 100644 --- a/src/packet/code_index_number.rs +++ b/src/packet/code_index_number.rs @@ -1,6 +1,5 @@ //! Enum representing the code index number of a packet. -use crate::data::u4::U4; use crate::packet::MidiPacketParsingError; /// The Code Index Number(CIN) indicates the classification @@ -85,12 +84,6 @@ impl TryFrom for CodeIndexNumber { } } -impl From for U4 { - fn from(value: CodeIndexNumber) -> U4 { - U4::from_overflowing_u8(value as u8) - } -} - impl CodeIndexNumber { /// Creates a new number from a MIDI event payload. pub fn try_from_payload(payload: &[u8]) -> Result {