Trait basic_dsp_vector::RededicateOps[][src]

pub trait RededicateOps<Other>: RededicateForceOps<Other> where
    Other: MetaData
{ fn rededicate_from(origin: Other) -> Self; }

This trait allows to change a data type. The operations will convert a type to a different one and set self.len() to zero. However self.allocated_len() will remain unchanged. The use case for this is to allow to reuse the memory of a vector for different operations.

If a type should always be converted without any checks then the RededicateForceOps trait provides option for that.

Required Methods

Make Other a Self.

Example

use basic_dsp_vector::*;
let complex = vec!(1.0, 2.0, 3.0, 4.0).to_complex_freq_vec();
let real = complex.phase();
let complex = ComplexTimeVec32::rededicate_from(real);
assert_eq!(true, complex.is_complex());
assert_eq!(DataDomain::Time, complex.domain());
assert_eq!(0, complex.len());
assert_eq!(4, complex.alloc_len());

Implementors