[][src]Trait basic_dsp_vector::RededicateOps

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

fn rededicate_from(origin: Other) -> Self

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());
Loading content...

Implementors

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>, 
[src]

Loading content...