Trait basic_dsp::SplitOps

source ·
pub trait SplitOps {
    // Required method
    fn split_into(&self, targets: &mut [&mut Self]) -> Result<(), ErrorReason>;
}
Expand description

Splits the data into several smaller pieces of equal size.

Required Methods§

source

fn split_into(&self, targets: &mut [&mut Self]) -> Result<(), ErrorReason>

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:

  1. InvalidArgumentLength: self.points() isn’t dividable by targets.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.

Implementors§

source§

impl<S, T, N, D> SplitOps for DspVec<S, T, N, D>
where S: ToSliceMut<T>, T: RealNumber, N: NumberSpace, D: Domain,