pub struct MidiPacket { /* private fields */ }Expand description
Packet containing the encoded event.
Implementations§
Source§impl MidiPacket
impl MidiPacket
Sourcepub const fn cable_number(&self) -> u8
pub const fn cable_number(&self) -> u8
Returns the cable number.
Sourcepub fn event(&self) -> &[u8]
pub fn event(&self) -> &[u8]
Returns the event bytes, or an empty slice when the packet uses a reserved CIN.
Sourcepub const fn event_len(&self) -> usize
pub const fn event_len(&self) -> usize
Returns the event length, 0 when the packet uses a reserved CIN.
Sourcepub fn try_encode(
cable_number: u8,
event: &[u8],
) -> Result<(Self, usize), MidiPacketError>
pub fn try_encode( cable_number: u8, event: &[u8], ) -> Result<(Self, usize), MidiPacketError>
Tries to create a packet from an event with relaxed length checking. The event slice can be longer than expected, additional bytes are ignored. The expected (and used) event length is returned in the result tuple as second member.
Sourcepub fn try_encode_exact(
cable_number: u8,
event: &[u8],
) -> Result<Self, MidiPacketError>
pub fn try_encode_exact( cable_number: u8, event: &[u8], ) -> Result<Self, MidiPacketError>
Tries to create a packet from an event with length checking. Returns an error if the event length does not match the expected length.
Sourcepub fn is_sysex_start(&self) -> bool
pub fn is_sysex_start(&self) -> bool
Checks if the event is the start of a SysEx message.
Sourcepub fn is_sysex_end(&self) -> bool
pub fn is_sysex_end(&self) -> bool
Checks if the event is the end of a SysEx message.
Trait Implementations§
Source§impl Clone for MidiPacket
impl Clone for MidiPacket
Source§fn clone(&self) -> MidiPacket
fn clone(&self) -> MidiPacket
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for MidiPacket
impl Debug for MidiPacket
impl Eq for MidiPacket
Source§impl Format for MidiPacket
impl Format for MidiPacket
Source§impl PartialEq for MidiPacket
impl PartialEq for MidiPacket
impl StructuralPartialEq for MidiPacket
Auto Trait Implementations§
impl Freeze for MidiPacket
impl RefUnwindSafe for MidiPacket
impl Send for MidiPacket
impl Sync for MidiPacket
impl Unpin for MidiPacket
impl UnsafeUnpin for MidiPacket
impl UnwindSafe for MidiPacket
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