[−][src]Function dasp_slice::boxed::from_boxed_sample_slice
pub fn from_boxed_sample_slice<T, S>(slice: Box<[S]>) -> Option<T> where
S: Sample,
T: FromBoxedSampleSlice<S>,
Converts the given boxed slice of Sample
s 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 FromBoxedSampleSlice
trait.
Examples
fn main() { let foo = vec![0.0, 0.5, 0.0, -0.5].into_boxed_slice(); let bar: Box<[[f32; 2]]> = dasp_slice::from_boxed_sample_slice(foo).unwrap(); assert_eq!(bar.into_vec(), vec![[0.0, 0.5], [0.0, -0.5]]); }
Required Features
- When using
dasp_slice
, this item requires the boxed feature to be enabled. - When using
dasp
, this item requires the slice-boxed feature to be enabled.