pub fn new(
        time_in_frames: i64,
        my_type: lv2_raw::LV2Urid,
        data: &[u8],
    ) -> Result<LV2AtomEventBuilder<MAX_SIZE>, EventError> {
        let mut buffer = [0; MAX_SIZE];
        if data.len() > buffer.len() {
            return Err(EventError::DataTooLarge {
                max_supported_size: MAX_SIZE,
                actual_size: data.len(),
            });
        }
        buffer[0..data.len()].copy_from_slice(data);
        Ok(LV2AtomEventBuilder {
            event: lv2_raw::LV2AtomEvent {
                time_in_frames,
                body: LV2Atom {
                    size: u32::try_from(data.len()).expect("Size exceeds u32 capacity."),
                    mytype: my_type,
                },
            },
            _data: buffer,
        })
    }
/// Create a new atom event with the given time and type.
///
/// # Note
/// If `data` is of type `[u8; MAX_SIZE]`, then consider using `new_full`.
///
/// # Errors
/// Returns an error if the size of the buffer is greater than `MAX_SIZE`.
Create a new atom event with the given time and type.
Create a new atom event with the given time and type .
pub fn new(
        time_in_frames: i64,
        my_type: lv2_raw::LV2Urid,
        data: &[u8],
    ) -> Result<LV2AtomEventBuilder<MAX_SIZE>, EventError> {
        let mut buffer = [0; MAX_SIZE];
        if data.len() > buffer.len() {
            return Err(EventError::DataTooLarge {
                max_supported_size: MAX_SIZE,
                actual_size: data.len(),
            });
        }
        buffer[0..data.len()].copy_from_slice(data);
        Ok(LV2AtomEventBuilder {
            event: lv2_raw::LV2AtomEvent {
                time_in_frames,
                body: LV2Atom {
                    size: u32::try_from(data.len()).expect("Size exceeds u32 capacity."),
                    mytype: my_type,
                },
            },
            _data: buffer,
        })
    }
pub fn new ( time_in_frames : i64 , my_type : lv2_raw :: LV2Urid , data : & [ u8 ] , ) -> Result < LV2AtomEventBuilder < MAX_SIZE > , EventError > { let mut buffer = [ 0 ; MAX_SIZE ] ; if data . len ( ) > buffer . len ( ) { return Err ( EventError :: DataTooLarge { max_supported_size : MAX_SIZE , actual_size : data . len ( ) , } ) ; } buffer [ 0 .. data . len ( ) ] . copy_from_slice ( data ) ; Ok ( LV2AtomEventBuilder { event : lv2_raw :: LV2AtomEvent { time_in_frames , body : LV2Atom { size : u32 :: try_from ( data . len ( ) ) . expect ( " " ) , mytype : my_type , } , } , _data : buffer , } ) }
Create a new atom event with the given time and type.
Create a new atom event with the given time and type .
time_in_frames
i64
my_type
lv2_raw::LV2Urid
data
&[u8]
time_in_frames
i64
my_type
lv2_raw::LV2Urid
data
&[u8]
note
If `data` is of type `[u8; MAX_SIZE]`, then consider using `new_full`.
If ` data ` is of type ` [ u8 ; MAX_SIZE ] ` then consider using ` new_full ` .
errors
Returns an error if the size of the buffer is greater than `MAX_SIZE`.
Returns an error if the size of the buffer is greater than ` MAX_SIZE ` .