Trait basic_dsp::RededicateOps
source · [−]pub trait RededicateOps<Other>: RededicateForceOps<Other>where
Other: MetaData,{
fn rededicate_from(origin: Other) -> Self;
}
Expand description
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
sourcefn rededicate_from(origin: Other) -> Self
fn rededicate_from(origin: Other) -> Self
Make Other
a Self
.
Example
extern crate num_complex;
use basic_dsp_vector::*;
use num_complex::Complex;
let complex = vec!(Complex::new(1.0, 2.0), Complex::new(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());