pub fn as_slice<T>(&self) -> Option<&[T]>
    where
        T: Sample,
    {
        if T::FORMAT == self.sample_format {
            // The safety of this block relies on correct construction of the `Data` instance. See
            // the unsafe `from_parts` constructor for these requirements.
            unsafe { Some(std::slice::from_raw_parts(self.data as *const T, self.len)) }
        } else {
            None
        }
    }
/// Access the data as a slice of sample type `T`.
///
/// Returns `None` if the sample type does not match the expected sample format.
Access the data as a slice of sample type `T`.
Returns `None` if the sample type does not match the expected sample format.
Access the data as a slice of sample type ` T ` . Returns ` None ` if the sample type does not match the expected sample format .
pub fn as_slice<T>(&self) -> Option<&[T]>
    where
        T: Sample,
    {
        if T::FORMAT == self.sample_format {
            // The safety of this block relies on correct construction of the `Data` instance. See
            // the unsafe `from_parts` constructor for these requirements.
            unsafe { Some(std::slice::from_raw_parts(self.data as *const T, self.len)) }
        } else {
            None
        }
    }
pub fn as_slice < T > ( & self ) -> Option < & [ T ] > where T : Sample , { if T :: FORMAT == self . sample_format { // The safety of this block relies on correct construction of the `Data` instance. See // the unsafe `from_parts` constructor for these requirements. unsafe { Some ( std :: slice :: from_raw_parts ( self . data as * const T , self . len ) ) } } else { None } }
Access the data as a slice of sample type `T`.
Access the data as a slice of sample type ` T ` .
&self
&self