Trait basic_dsp::RededicateOps

source ·
pub trait RededicateOps<Other>: RededicateForceOps<Other>
where Other: MetaData,
{ // Required method 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§

source

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());

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<S, T, N, D, O> RededicateOps<O> for DspVec<S, T, N, D>
where S: ToSlice<T>, T: RealNumber, DspVec<S, T, N, D>: RededicateForceOps<O>, N: NumberSpace, D: Domain, O: Vector<T>,