[][src]Function dasp_slice::from_sample_slice

pub fn from_sample_slice<'a, T, S>(slice: &'a [S]) -> Option<T> where
    S: Sample,
    T: FromSampleSlice<'a, S>, 

Converts the given slice of Samples into some slice T.

Returns None if the number of channels in a single frame is not a multiple of the number of samples in the given slice.

This is a convenience function that wraps the FromSampleSlice trait.

Examples

fn main() {
    let foo = &[0.0, 0.5, 0.0, -0.5][..];
    let bar: Option<&_> = dasp_slice::from_sample_slice(foo);
    assert_eq!(bar, Some(&[[0.0, 0.5], [0.0, -0.5]][..]));
}