Trait substrate::simulation::waveform::TimeWaveform
source · 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§
sourcetype 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>
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§
Provided Methods§
sourcefn first_t(&self) -> Option<Self::Data>
fn first_t(&self) -> Option<Self::Data>
The time associated with the first point in the waveform.
sourcefn first_x(&self) -> Option<Self::Data>
fn first_x(&self) -> Option<Self::Data>
The value associated with the first point in the waveform.
sourcefn last_t(&self) -> Option<Self::Data>
fn last_t(&self) -> Option<Self::Data>
The time associated with the last point in the waveform.
sourcefn last_x(&self) -> Option<Self::Data>
fn last_x(&self) -> Option<Self::Data>
The value associated with the last point in the waveform.
sourcefn edges(&self, threshold: Self::Data) -> Edges<'_, Self, Self::Data>
fn edges(&self, threshold: Self::Data) -> Edges<'_, Self, Self::Data>
Returns an iterator over the edges in the waveform.
See Edges
for more information.
sourcefn transitions(
&self,
low_threshold: Self::Data,
high_threshold: Self::Data
) -> Transitions<'_, Self, Self::Data>
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.
sourcefn values(&self) -> Values<'_, Self> ⓘ
fn values(&self) -> Values<'_, Self> ⓘ
Returns an iterator over the values in the waveform.
See Values
for more information.
sourcefn time_index_before(&self, t: Self::Data) -> Option<usize>
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
.
sourcefn sample_at(&self, t: Self::Data) -> Self::Data
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.