pub struct TimeFunc(pub Vec<(DateTime<Utc>, f64)>);
Expand description

A vector of data points that we can use to analyse time series data. Each data point is valid from the previous timestamp until its current timestamp. If it is the first point of data then it is only valid for a total time of 0.

                .B
          |    /\    |
          |   /  \   |
          |  /    \  |
          | /      \ |
         A./        \.C
__________|__________|_________
Invalid   |  Valid   |  Invalid
_______________________________
          .     .    .
          A     B    C

Tuple Fields

0: Vec<(DateTime<Utc>, f64)>

Implementations

Creates an empty TimeFunc

Gets the average of the function from time, to time - duration This function isn’t perfects acurate as it uses the closest available indeces, and does not interpolate

Gets the average of the function from time, to time - duration This function interpolates the function and uses exact positions

Gets the linear interpolated average of the function

Get’s the normalized RMS Does not use interpolation as of yet

Returns the fractional index of a specific time

Verifies that the timefunc is valid. Checks to ensure the list is sorted and deduped.

Executed dedup Assumes vec is sorted.

Verifies that the function is deduped Assumes vec is sorted is sorted.

Fixes the TimeFunc by sorting it.

Trait Implementations

Returns a copy of the value. Read more

Performs copy-assignment from source. Read more

Formats the value using the given formatter. Read more

Returns the “default value” for a type. Read more

Deserialize this value from the given Serde deserializer. Read more

The resulting type after applying the / operator.

Performs the / operation. Read more

Converts to this type from the input type.

The resulting type after applying the * operator.

Performs the * operation. Read more

Serialize this value into the given Serde serializer. Read more

Auto Trait Implementations

Blanket Implementations

Gets the TypeId of self. Read more

Immutably borrows from an owned value. Read more

Mutably borrows from an owned value. Read more

Returns the argument unchanged.

Calls U::from(self).

That is, this conversion is whatever the implementation of From<T> for U chooses to do.

The resulting type after obtaining ownership.

Creates owned data from borrowed data, usually by cloning. Read more

Uses borrowed data to replace owned data, usually by cloning. Read more

The type returned in the event of a conversion error.

Performs the conversion.

The type returned in the event of a conversion error.

Performs the conversion.