Skip to content

Commit

Permalink
Removed UsbMidiEventPacket::from_message function
Browse files Browse the repository at this point in the history
  • Loading branch information
sourcebox committed Dec 19, 2024
1 parent 9b634eb commit d6383c8
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 7 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,6 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

### Changed

- Renamed `UsbMidiEventPacket::from_midi` function to `UsbMidiEventPacket::from_message`.
- Renamed `MidiClass::send_message` function to `MidiClass::send_packet`.
- Renamed `midi_device` module to `class`.
- Renamed `usb_midi` module to `packet` and moved it into crate root.
Expand All @@ -36,6 +35,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/spec/v2.0.0.

- `UsbMidiEventPacket::cable_number` field, use function instead.
- `UsbMidiEventPacket::message` field, use function instead.
- `UsbMidiEventPacket::from_midi` function, use `Message::into_packet` instead.

## [0.3.0] - 2024-05-27

Expand Down
7 changes: 1 addition & 6 deletions src/packet/event_packet.rs
Original file line number Diff line number Diff line change
Expand Up @@ -101,18 +101,13 @@ impl UsbMidiEventPacket {
self.raw.clone()
}

/// Creates a packet from a message and returns it.
pub fn from_message(cable: CableNumber, message: Message) -> Self {
message.into_packet(cable)
}

/// Creates a packet from a slice of message bytes.
pub fn from_message_bytes(
cable: CableNumber,
bytes: &[u8],
) -> Result<Self, MidiPacketParsingError> {
let message = Message::try_from(bytes)?;

Ok(Self::from_message(cable, message))
Ok(message.into_packet(cable))
}
}

0 comments on commit d6383c8

Please sign in to comment.