pub fn try_from_slice(
        frame_offset: MidiFrameOffset,
        midi_message: &[u8],
    ) -> Result<Self, &'static str> {
        if midi_message.len() > Self::MAX_LENGTH {
            return Err("given MIDI message too long");
        }
        let mut array = [0; Self::MAX_LENGTH];
        array[..midi_message.len()].copy_from_slice(midi_message);
        Ok(Self::new(frame_offset, array, midi_message.len() as _))
    }
/// Attempts to create a long MIDI event from the given slice.
///
/// Involves copying.
///
/// # Errors
///
/// Returns an error if the given slice is longer than the supported maximum.
Attempts to create a long MIDI event from the given slice.
Involves copying.
Attempts to create a long MIDI event from the given slice . Involves copying .
pub fn try_from_slice(
        frame_offset: MidiFrameOffset,
        midi_message: &[u8],
    ) -> Result<Self, &'static str> {
        if midi_message.len() > Self::MAX_LENGTH {
            return Err("given MIDI message too long");
        }
        let mut array = [0; Self::MAX_LENGTH];
        array[..midi_message.len()].copy_from_slice(midi_message);
        Ok(Self::new(frame_offset, array, midi_message.len() as _))
    }
pub fn try_from_slice ( frame_offset : MidiFrameOffset , midi_message : & [ u8 ] , ) -> Result < Self , & ' static str > { if midi_message . len ( ) > Self :: MAX_LENGTH { return Err ( " " ) ; } let mut array = [ 0 ; Self :: MAX_LENGTH ] ; array [ .. midi_message . len ( ) ] . copy_from_slice ( midi_message ) ; Ok ( Self :: new ( frame_offset , array , midi_message . len ( ) as _ ) ) }
Attempts to create a long MIDI event from the given slice.
Attempts to create a long MIDI event from the given slice .
frame_offset
MidiFrameOffset
midi_message
&[u8]
frame_offset
MidiFrameOffset
midi_message
&[u8]
errors
Returns an error if the given slice is longer than the supported maximum.
Returns an error if the given slice is longer than the supported maximum .