Trait basic_dsp::DataVector [] [src]

pub trait DataVector<T>: Sized where T: RealNumber {
    fn data(&self) -> &[T];
    fn delta(&self) -> T;
    fn domain(&self) -> DataVectorDomain;
    fn is_complex(&self) -> bool;
    fn len(&self) -> usize;
    fn set_len(&mut self, len: usize);
    fn points(&self) -> usize;
    fn allocated_len(&self) -> usize;
}

DataVector gives access to the basic properties of all data vectors

A DataVector allocates memory if necessary. It will however never shrink/free memory unless it's deleted and dropped.

Required Methods

fn data(&self) -> &[T]

Gives direct access to the underlying data sequence. It's recommended to use the `Index functions . For users outside of Rust: It's discouraged to hold references to this array while executing operations on the vector, since the vector may decide at any operation to invalidate the array.

fn delta(&self) -> T

The x-axis delta. If domain is time domain then delta is in [s], in frequency domain delta is in [Hz].

fn domain(&self) -> DataVectorDomain

The domain in which the data vector resides. Basically specifies the x-axis and the type of operations which are valid on this vector.

fn is_complex(&self) -> bool

Indicates whether the vector contains complex data. This also specifies the type of operations which are valid on this vector.

fn len(&self) -> usize

The number of valid elements in the the vector.

fn set_len(&mut self, len: usize)

Sets the vector length to the given length. If self.len() < len then the value of the new elements is undefined.

fn points(&self) -> usize

The number of valid points. If the vector is complex then every valid point consists of two floating point numbers, while for real vectors every point only consists of one floating point number.

fn allocated_len(&self) -> usize

Gets the number of allocated elements in the underlying vector. The allocated length may be larger than the length of valid points. In most cases you likely want to have lenor points instead.

Implementors