Trait basic_dsp_vector::FromVector
source · pub trait FromVector<T>where
T: RealNumber,{
type Output;
// Required method
fn get(self) -> (Self::Output, usize);
}
Expand description
Retrieves the underlying storage from a vector.
If you are working with std::vec::Vec
then it’s recommended to use
Into
instead of this one, as
it’s more straightforward to use.
Required Associated Types§
Required Methods§
sourcefn get(self) -> (Self::Output, usize)
fn get(self) -> (Self::Output, usize)
If you are working with std::vec::Vec
then it’s recommended to use
Into
instead of this one, as
it’s more straightforward to use.
Gets the underlying storage and the number of elements which
contain valid data. Therefore a caller should only use the first valid data
elements from the storage.
The remaining elements (if there are any) might have been allocated during the calculations but contain
no useful information.
§Example
use basic_dsp_vector::*;
let v: Vec<Complex<f64>> = vec!(Complex::new(1.0, 2.0), Complex::new(3.0, 4.0));
let v: DspVec<Vec<f64>, f64, meta::Complex, meta::Time> = v.to_complex_time_vec();
let (v, p): (Vec<Complex<f64>>, usize) = v.get();
assert_eq!(2, p);
assert_eq!(vec!(Complex::new(1.0, 2.0), Complex::new(3.0, 4.0)), v);