Function dsp::slice::to_boxed_frame_slice
[−]
[src]
pub fn to_boxed_frame_slice<T, F>(slice: T) -> Option<Box<[F]>> where F: Frame, T: ToBoxedFrameSlice<F>
Converts the given boxed slice into a boxed slice of Frame
s.
Returns None
if the number of channels in a single frame F
is not a multiple of the number
of samples in the given slice.
This is a convenience function that wraps the ToBoxedFrameSlice
trait.
Examples
extern crate sample; fn main() { let foo = vec![0.0, 0.5, 0.0, -0.5].into_boxed_slice(); let bar: Box<[[f32; 2]]> = sample::slice::to_boxed_frame_slice(foo).unwrap(); assert_eq!(bar.into_vec(), vec![[0.0, 0.5], [0.0, -0.5]]); let foo = vec![0.0, 0.5, 0.0].into_boxed_slice(); let bar = sample::slice::to_boxed_frame_slice(foo); assert_eq!(bar, None::<Box<[[f32; 2]]>>); }