[−][src]Function dasp::slice::to_frame_slice_mut
pub fn to_frame_slice_mut<'a, T, F>(slice: T) -> Option<&'a mut [F]> where
F: Frame,
T: ToFrameSliceMut<'a, F>,
Converts the given mutable slice into a mutable 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 ToFrameSliceMut
trait.
Examples
fn main() { let foo = &mut [0.0, 0.5, 0.0, -0.5][..]; let bar = dasp_slice::to_frame_slice_mut(foo); assert_eq!(bar, Some(&mut [[0.0, 0.5], [0.0, -0.5]][..])); let foo = &mut [0.0, 0.5, 0.0][..]; let bar = dasp_slice::to_frame_slice_mut(foo); assert_eq!(bar, None::<&mut [[f32; 2]]>); }