Trait basic_dsp_vector::SplitOps
source · pub trait SplitOps {
// Required method
fn split_into(&self, targets: &mut [&mut Self]) -> VoidResult;
}
Expand description
Splits the data into several smaller pieces of equal size.
Required Methods§
sourcefn split_into(&self, targets: &mut [&mut Self]) -> VoidResult
fn split_into(&self, targets: &mut [&mut Self]) -> VoidResult
Splits the vector into several smaller vectors. self.len()
must be dividable by
targets.len()
without a remainder and this condition must be true too
targets.len() > 0
.
§Failures
TransRes may report the following ErrorReason
members:
InvalidArgumentLength
:self.points()
isn’t dividable bytargets.len()
§Example
use basic_dsp_vector::*;
let mut vector =
vec!(1.0, 2.0, 3.0, 4.0, 5.0, 6.0, 7.0, 8.0, 9.0, 10.0).to_real_time_vec();
let mut split = &mut
[&mut Vec::new().to_real_time_vec(),
&mut Vec::new().to_real_time_vec()];
vector.split_into(split).expect("Ignoring error handling in examples");
assert_eq!([1.0, 3.0, 5.0, 7.0, 9.0], split[0][..]);
Object Safety§
This trait is not object safe.