pub struct UmpPacket { /* private fields */ }Expand description
Universal MIDI Packet (UMP).
Contains between 1 and 4 32-bit words.
Implementations§
Source§impl UmpPacket
impl UmpPacket
Sourcepub const fn from_u32(w0: u32) -> Result<Self, UmpError>
pub const fn from_u32(w0: u32) -> Result<Self, UmpError>
Create a single-word (32-bit) UMP packet.
Sourcepub const fn from_u32_pair(w0: u32, w1: u32) -> Result<Self, UmpError>
pub const fn from_u32_pair(w0: u32, w1: u32) -> Result<Self, UmpError>
Create a two-word (64-bit) UMP packet.
Sourcepub const fn from_u32_triple(
w0: u32,
w1: u32,
w2: u32,
) -> Result<Self, UmpError>
pub const fn from_u32_triple( w0: u32, w1: u32, w2: u32, ) -> Result<Self, UmpError>
Create a three-word (96-bit) UMP packet.
Sourcepub const fn from_u32_quad(
w0: u32,
w1: u32,
w2: u32,
w3: u32,
) -> Result<Self, UmpError>
pub const fn from_u32_quad( w0: u32, w1: u32, w2: u32, w3: u32, ) -> Result<Self, UmpError>
Create a four-word (128-bit) UMP packet.
Sourcepub fn from_words(words: &[u32]) -> Result<Self, UmpError>
pub fn from_words(words: &[u32]) -> Result<Self, UmpError>
Create a UMP packet from a slice of words, verifying word length against the message type.
Sourcepub fn message_type(&self) -> MessageType
pub fn message_type(&self) -> MessageType
Returns the message type of the packet.
Sourcepub fn group(&self) -> Option<u8>
pub fn group(&self) -> Option<u8>
Returns the group index (0..15), or None for Utility and Stream messages, which have none.
Sourcepub fn in_groups(&self, mask: u16) -> bool
pub fn in_groups(&self, mask: u16) -> bool
Whether the packet is accepted by mask (bit n = group n); groupless packets always are.
Sourcepub fn channel(&self) -> Option<u8>
pub fn channel(&self) -> Option<u8>
Returns the channel (0..15), or None unless this is a channel voice message.
Sourcepub fn word_count(&self) -> usize
pub fn word_count(&self) -> usize
Returns the number of 32-bit words in this packet.
Sourcepub fn byte_count(&self) -> usize
pub fn byte_count(&self) -> usize
Returns the byte length of this packet when serialized.
Trait Implementations§
impl Copy for UmpPacket
impl Eq for UmpPacket
impl StructuralPartialEq for UmpPacket
Auto Trait Implementations§
impl Forget for UmpPacket
impl Freeze for UmpPacket
impl Move for UmpPacket
impl RefUnwindSafe for UmpPacket
impl Send for UmpPacket
impl Sync for UmpPacket
impl Unpin for UmpPacket
impl UnsafeUnpin for UmpPacket
impl UnwindSafe for UmpPacket
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