pub trait TimeWaveform {
    type Data: Copy + From<i32> + Add<Self::Data, Output = Self::Data> + Div<Self::Data, Output = Self::Data> + PartialOrd + Sub<Self::Data, Output = Self::Data> + Mul<Self::Data, Output = Self::Data>;

Show 18 methods // Required methods fn get(&self, idx: usize) -> Option<TimePoint<Self::Data>>; fn len(&self) -> usize; // Provided methods fn is_empty(&self) -> bool { ... } fn first_t(&self) -> Option<Self::Data> { ... } fn first_x(&self) -> Option<Self::Data> { ... } fn last_t(&self) -> Option<Self::Data> { ... } fn last_x(&self) -> Option<Self::Data> { ... } fn first(&self) -> Option<TimePoint<Self::Data>> { ... } fn last(&self) -> Option<TimePoint<Self::Data>> { ... } fn edges(&self, threshold: Self::Data) -> Edges<'_, Self, Self::Data> { ... } fn transitions( &self, low_threshold: Self::Data, high_threshold: Self::Data ) -> Transitions<'_, Self, Self::Data> { ... } fn values(&self) -> Values<'_, Self> { ... } fn time_index_before(&self, t: Self::Data) -> Option<usize> { ... } fn sample_at(&self, t: Self::Data) -> Self::Data { ... } fn max_x(&self) -> Option<Self::Data> { ... } fn min_x(&self) -> Option<Self::Data> { ... } fn mid_x(&self) -> Option<Self::Data> { ... } fn integral(&self) -> Self::Data { ... }
}
Expand description

A time-domain waveform.

Required Associated Types§

source

type Data: Copy + From<i32> + Add<Self::Data, Output = Self::Data> + Div<Self::Data, Output = Self::Data> + PartialOrd + Sub<Self::Data, Output = Self::Data> + Mul<Self::Data, Output = Self::Data>

The datatype of time and signal values in the waveform.

Typically, this should be f64 or [rust_decimal::Decimal].

Required Methods§

source

fn get(&self, idx: usize) -> Option<TimePoint<Self::Data>>

Get the value of the waveform at the given index.

source

fn len(&self) -> usize

Returns the number of time points in the waveform.

Provided Methods§

source

fn is_empty(&self) -> bool

Returns true if the waveform is empty.

source

fn first_t(&self) -> Option<Self::Data>

The time associated with the first point in the waveform.

source

fn first_x(&self) -> Option<Self::Data>

The value associated with the first point in the waveform.

source

fn last_t(&self) -> Option<Self::Data>

The time associated with the last point in the waveform.

source

fn last_x(&self) -> Option<Self::Data>

The value associated with the last point in the waveform.

source

fn first(&self) -> Option<TimePoint<Self::Data>>

The first point in the waveform.

source

fn last(&self) -> Option<TimePoint<Self::Data>>

The last point in the waveform.

source

fn edges(&self, threshold: Self::Data) -> Edges<'_, Self, Self::Data>

Returns an iterator over the edges in the waveform.

See Edges for more information.

source

fn transitions( &self, low_threshold: Self::Data, high_threshold: Self::Data ) -> Transitions<'_, Self, Self::Data>

Returns an iterator over the transitions in the waveform.

See Transitions for more information.

source

fn values(&self) -> Values<'_, Self>

Returns an iterator over the values in the waveform.

See Values for more information.

source

fn time_index_before(&self, t: Self::Data) -> Option<usize>

Returns the index of the last point in the waveform with a time before t.

source

fn sample_at(&self, t: Self::Data) -> Self::Data

Retrieves the value of the waveform at the given time.

By default, linearly interpolates between two adjacent points on the waveform.

source

fn max_x(&self) -> Option<Self::Data>

Returns the maximum value seen in this waveform.

source

fn min_x(&self) -> Option<Self::Data>

Returns the minimum value seen in this waveform.

source

fn mid_x(&self) -> Option<Self::Data>

Returns the middle value seen in this waveform.

This is typically the arithmetic average of the max and min values.

source

fn integral(&self) -> Self::Data

Returns the time integral of this waveform.

By default, uses trapezoidal integration. Returns 0.0 if the length of the waveform is less than 2.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<'a, T> TimeWaveform for WaveformRef<'a, T>
where T: Copy + Add<T, Output = T> + Div<T, Output = T> + PartialOrd + Sub<T, Output = T> + Mul<T, Output = T> + From<i32>,

§

type Data = T

source§

impl<T> TimeWaveform for Waveform<T>
where T: Copy + Add<T, Output = T> + Div<T, Output = T> + PartialOrd + Sub<T, Output = T> + Mul<T, Output = T> + From<i32>,

§

type Data = T