usbd_midi/message/raw.rs
1//! Type for the raw MIDI message.
2
3use crate::message::data::u7::U7;
4
5/// Represents the payloads that the midi message may contain.
6#[derive(Debug, Clone, Eq, PartialEq)]
7pub enum Payload {
8 /// No payload.
9 Empty,
10 /// One-byte payload.
11 SingleByte(U7),
12 /// Two-byte payload.
13 DoubleByte(U7, U7),
14}
15
16/// A struct that captures the valid states.
17///
18/// A midi message may be in, but without domain logic mainly useful for serializing.
19/// This represents the possible 'shapes', doesn't verify if the data makes sense though!
20#[derive(Debug, Clone, Eq, PartialEq)]
21pub struct Raw {
22 /// Status byte.
23 pub status: u8,
24 /// Payload of maximum 2 bytes.
25 pub payload: Payload,
26}