[−][src]Enum helgoboss_midi::StructuredShortMessage
A short message implemented as an enum where each variant contains exactly the data which is relevant for the particular message type.
This enum is primarily intended for read-only usage via pattern matching. For that reason each variant is a struct-like enum, which is ideal for pattern matching while it is less ideal for reuse (the data contained in the variant can't be passed around in one piece).
The enum's size in memory is currently 4 bytes.
Example
use helgoboss_midi::{ controller_numbers, Channel, RawShortMessage, ShortMessage, ShortMessageFactory, StructuredShortMessage, U7, }; let msg = RawShortMessage::control_change( Channel::new(5), controller_numbers::DAMPER_PEDAL_ON_OFF, U7::new(100), ); let structured_msg = msg.to_structured(); match structured_msg { StructuredShortMessage::ControlChange { channel, controller_number, control_value, } => { assert_eq!(channel.get(), 5); assert_eq!(controller_number.get(), 64); assert_eq!(control_value.get(), 100); } _ => panic!("wrong type"), }; assert_eq!(structured_msg.channel(), Some(Channel::new(5))); assert_eq!(core::mem::size_of_val(&structured_msg), 4);
Variants
Fields of ControlChange
TimeCodeQuarterFrame(TimeCodeQuarterFrame)
Fields of SongPositionPointer
position: U14
Fields of SongSelect
song_number: U7
Trait Implementations
impl Clone for StructuredShortMessage
[src]
pub fn clone(&self) -> StructuredShortMessage
[src]
pub fn clone_from(&mut self, source: &Self)
1.0.0[src]
impl Copy for StructuredShortMessage
[src]
impl Debug for StructuredShortMessage
[src]
impl Eq for StructuredShortMessage
[src]
impl Hash for StructuredShortMessage
[src]
pub fn hash<__H: Hasher>(&self, state: &mut __H)
[src]
pub fn hash_slice<H>(data: &[Self], state: &mut H) where
H: Hasher,
1.3.0[src]
H: Hasher,
impl Ord for StructuredShortMessage
[src]
pub fn cmp(&self, other: &StructuredShortMessage) -> Ordering
[src]
#[must_use]pub fn max(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn min(self, other: Self) -> Self
1.21.0[src]
#[must_use]pub fn clamp(self, min: Self, max: Self) -> Self
1.50.0[src]
impl PartialEq<StructuredShortMessage> for StructuredShortMessage
[src]
pub fn eq(&self, other: &StructuredShortMessage) -> bool
[src]
pub fn ne(&self, other: &StructuredShortMessage) -> bool
[src]
impl PartialOrd<StructuredShortMessage> for StructuredShortMessage
[src]
pub fn partial_cmp(&self, other: &StructuredShortMessage) -> Option<Ordering>
[src]
pub fn lt(&self, other: &StructuredShortMessage) -> bool
[src]
pub fn le(&self, other: &StructuredShortMessage) -> bool
[src]
pub fn gt(&self, other: &StructuredShortMessage) -> bool
[src]
pub fn ge(&self, other: &StructuredShortMessage) -> bool
[src]
impl ShortMessage for StructuredShortMessage
[src]
pub fn status_byte(&self) -> u8
[src]
pub fn data_byte_1(&self) -> U7
[src]
pub fn data_byte_2(&self) -> U7
[src]
pub fn to_structured(&self) -> StructuredShortMessage
[src]
pub fn to_bytes(&self) -> (u8, U7, U7)
[src]
pub fn to_other<O: ShortMessageFactory>(&self) -> O
[src]
pub fn type(&self) -> ShortMessageType
[src]
pub fn super_type(&self) -> MessageSuperType
[src]
pub fn main_category(&self) -> MessageMainCategory
[src]
pub fn is_note_on(&self) -> bool
[src]
pub fn is_note_off(&self) -> bool
[src]
pub fn is_note(&self) -> bool
[src]
pub fn channel(&self) -> Option<Channel>
[src]
pub fn key_number(&self) -> Option<KeyNumber>
[src]
pub fn velocity(&self) -> Option<U7>
[src]
pub fn controller_number(&self) -> Option<ControllerNumber>
[src]
pub fn control_value(&self) -> Option<U7>
[src]
pub fn program_number(&self) -> Option<U7>
[src]
pub fn pressure_amount(&self) -> Option<U7>
[src]
pub fn pitch_bend_value(&self) -> Option<U14>
[src]
impl ShortMessageFactory for StructuredShortMessage
[src]
pub unsafe fn from_bytes_unchecked(
(status_byte, data_byte_1, data_byte_2): (u8, U7, U7)
) -> Self
[src]
(status_byte, data_byte_1, data_byte_2): (u8, U7, U7)
) -> Self
pub fn from_bytes(bytes: (u8, U7, U7)) -> Result<Self, FromBytesError>
[src]
pub fn from_other(msg: &impl ShortMessage) -> Self
[src]
pub fn channel_message(
r#type: ShortMessageType,
channel: Channel,
data_1: U7,
data_2: U7
) -> Self
[src]
r#type: ShortMessageType,
channel: Channel,
data_1: U7,
data_2: U7
) -> Self
pub fn system_common_message(
r#type: ShortMessageType,
data_1: U7,
data_2: U7
) -> Self
[src]
r#type: ShortMessageType,
data_1: U7,
data_2: U7
) -> Self
pub fn system_real_time_message(r#type: ShortMessageType) -> Self
[src]
pub fn note_on(channel: Channel, key_number: KeyNumber, velocity: U7) -> Self
[src]
pub fn note_off(channel: Channel, key_number: KeyNumber, velocity: U7) -> Self
[src]
pub fn control_change(
channel: Channel,
controller_number: ControllerNumber,
control_value: U7
) -> Self
[src]
channel: Channel,
controller_number: ControllerNumber,
control_value: U7
) -> Self
pub fn program_change(channel: Channel, program_number: U7) -> Self
[src]
pub fn polyphonic_key_pressure(
channel: Channel,
key_number: KeyNumber,
pressure_amount: U7
) -> Self
[src]
channel: Channel,
key_number: KeyNumber,
pressure_amount: U7
) -> Self
pub fn channel_pressure(channel: Channel, pressure_amount: U7) -> Self
[src]
pub fn pitch_bend_change(channel: Channel, pitch_bend_value: U14) -> Self
[src]
pub fn system_exclusive_start() -> Self
[src]
pub fn time_code_quarter_frame(frame: TimeCodeQuarterFrame) -> Self
[src]
pub fn song_position_pointer(position: U14) -> Self
[src]
pub fn song_select(song_number: U7) -> Self
[src]
pub fn tune_request() -> Self
[src]
pub fn system_exclusive_end() -> Self
[src]
pub fn timing_clock() -> Self
[src]
pub fn start() -> Self
[src]
pub fn continue() -> Self
[src]
pub fn stop() -> Self
[src]
pub fn active_sensing() -> Self
[src]
pub fn system_reset() -> Self
[src]
impl StructuralEq for StructuredShortMessage
[src]
impl StructuralPartialEq for StructuredShortMessage
[src]
Auto Trait Implementations
impl RefUnwindSafe for StructuredShortMessage
impl Send for StructuredShortMessage
impl Sync for StructuredShortMessage
impl Unpin for StructuredShortMessage
impl UnwindSafe for StructuredShortMessage
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,