Struct TimeSeries

Source
pub struct TimeSeries<T>(pub Vec<T>);

Tuple Fields§

§0: Vec<T>

Implementations§

Source§

impl<T> TimeSeries<T>
where T: Clone,

Source

pub fn new() -> Self

Source

pub fn push(&mut self, value: T)

Source

pub fn pop(&mut self) -> Option<T>

Source

pub fn is_empty(&self) -> bool

Source

pub fn first(&self) -> Option<T>

Source

pub fn last(&self) -> Option<T>

Source

pub fn clear(&mut self)

Source

pub fn get(&self, index: usize) -> Option<T>

Source

pub fn filter<F>(&self, f: F) -> Self
where F: Fn(&T) -> bool,

Source

pub fn reverse(&self) -> Self

Source

pub fn append(&mut self, other: &Self)

Source

pub fn map<U, F>(&self, f: F) -> TimeSeries<U>
where F: Fn(&T) -> U,

Given a function f: T -> U that converts data to indicator, give a function map: TimeSeries<T> -> TimeSeries<U> that converts time series data to time series indices

Source

pub fn len(&self) -> usize

Source

pub fn slice(&self, range: Range<usize>) -> Self

Source§

impl<T, E> TimeSeries<Result<T, E>>

Source

pub fn unwrap(self) -> Result<TimeSeries<T>, E>

Trait Implementations§

Source§

impl<T> Add<&TimeSeries<T>> for &TimeSeries<T>
where for<'a> &'a T: Add<Output = T>, TimeSeries<T>: Clone,

Source§

type Output = TimeSeries<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: &TimeSeries<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<&TimeSeries<T>> for TimeSeries<T>
where for<'a> &'a T: Add<Output = T>,

Source§

type Output = TimeSeries<T>

The resulting type after applying the + operator.
Source§

fn add(self, other: &Self) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add<TimeSeries<T>> for &TimeSeries<T>
where for<'a> &'a T: Add<Output = T>, TimeSeries<T>: Clone,

Source§

type Output = TimeSeries<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: TimeSeries<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> Add for TimeSeries<T>
where for<'a> &'a T: Add<Output = T>,

Source§

type Output = TimeSeries<T>

The resulting type after applying the + operator.
Source§

fn add(self, rhs: TimeSeries<T>) -> Self::Output

Performs the + operation. Read more
Source§

impl<T> AddAssign<&TimeSeries<T>> for TimeSeries<T>
where for<'a> &'a T: Add<Output = T>, TimeSeries<T>: Default,

Source§

fn add_assign(&mut self, rhs: &TimeSeries<T>)

Performs the += operation. Read more
Source§

impl<T> AddAssign for TimeSeries<T>
where for<'a> &'a T: Add<Output = T>, TimeSeries<T>: Default,

Source§

fn add_assign(&mut self, rhs: TimeSeries<T>)

Performs the += operation. Read more
Source§

impl<T> AsMut<[T]> for TimeSeries<T>

Source§

fn as_mut(&mut self) -> &mut [T]

Converts this type into a mutable reference of the (usually inferred) input type.
Source§

impl<T> AsRef<[T]> for TimeSeries<T>

Source§

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

Converts this type into a shared reference of the (usually inferred) input type.
Source§

impl<T: Clone> Clone for TimeSeries<T>

Source§

fn clone(&self) -> TimeSeries<T>

Returns a copy of the value. Read more
1.0.0 · Source§

fn clone_from(&mut self, source: &Self)

Performs copy-assignment from source. Read more
Source§

impl<T: Debug> Debug for TimeSeries<T>

Source§

fn fmt(&self, f: &mut Formatter<'_>) -> Result

Formats the value using the given formatter. Read more
Source§

impl<T> Default for TimeSeries<T>

Source§

fn default() -> Self

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

impl<T> Div<&TimeSeries<T>> for &TimeSeries<T>
where for<'a> &'a T: Div<Output = T>, TimeSeries<T>: Clone,

Source§

type Output = TimeSeries<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: &TimeSeries<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<&TimeSeries<T>> for TimeSeries<T>
where for<'a> &'a T: Div<Output = T>,

Source§

type Output = TimeSeries<T>

The resulting type after applying the / operator.
Source§

fn div(self, other: &Self) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div<TimeSeries<T>> for &TimeSeries<T>
where for<'a> &'a T: Div<Output = T>, TimeSeries<T>: Clone,

Source§

type Output = TimeSeries<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: TimeSeries<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> Div for TimeSeries<T>
where for<'a> &'a T: Div<Output = T>,

Source§

type Output = TimeSeries<T>

The resulting type after applying the / operator.
Source§

fn div(self, rhs: TimeSeries<T>) -> Self::Output

Performs the / operation. Read more
Source§

impl<T> DivAssign<&TimeSeries<T>> for TimeSeries<T>
where for<'a> &'a T: Div<Output = T>, TimeSeries<T>: Default,

Source§

fn div_assign(&mut self, rhs: &TimeSeries<T>)

Performs the /= operation. Read more
Source§

impl<T> DivAssign for TimeSeries<T>
where for<'a> &'a T: Div<Output = T>, TimeSeries<T>: Default,

Source§

fn div_assign(&mut self, rhs: TimeSeries<T>)

Performs the /= operation. Read more
Source§

impl<T> Extend<T> for TimeSeries<T>

Source§

fn extend<I: IntoIterator<Item = T>>(&mut self, iter: I)

Extends a collection with the contents of an iterator. Read more
Source§

fn extend_one(&mut self, item: A)

🔬This is a nightly-only experimental API. (extend_one)
Extends a collection with exactly one element.
Source§

fn extend_reserve(&mut self, additional: usize)

🔬This is a nightly-only experimental API. (extend_one)
Reserves capacity in a collection for the given number of additional elements. Read more
Source§

impl<T> FromIterator<T> for TimeSeries<T>

Source§

fn from_iter<I: IntoIterator<Item = T>>(iter: I) -> Self

Creates a value from an iterator. Read more
Source§

impl<T> Index<Range<usize>> for TimeSeries<T>

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, range: Range<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<RangeFrom<usize>> for TimeSeries<T>

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, range: RangeFrom<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<RangeTo<usize>> for TimeSeries<T>

Source§

type Output = [T]

The returned type after indexing.
Source§

fn index(&self, range: RangeTo<usize>) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> Index<usize> for TimeSeries<T>

Source§

type Output = T

The returned type after indexing.
Source§

fn index(&self, index: usize) -> &Self::Output

Performs the indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<Range<usize>> for TimeSeries<T>

Source§

fn index_mut(&mut self, range: Range<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<RangeFrom<usize>> for TimeSeries<T>

Source§

fn index_mut(&mut self, range: RangeFrom<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<RangeTo<usize>> for TimeSeries<T>

Source§

fn index_mut(&mut self, range: RangeTo<usize>) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<T> IndexMut<usize> for TimeSeries<T>

Source§

fn index_mut(&mut self, index: usize) -> &mut Self::Output

Performs the mutable indexing (container[index]) operation. Read more
Source§

impl<'a, T> IntoIterator for &'a TimeSeries<T>

Source§

type Item = &'a T

The type of the elements being iterated over.
Source§

type IntoIter = Iter<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<'a, T> IntoIterator for &'a mut TimeSeries<T>

Source§

type Item = &'a mut T

The type of the elements being iterated over.
Source§

type IntoIter = IterMut<'a, T>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T> IntoIterator for TimeSeries<T>

Source§

type Item = T

The type of the elements being iterated over.
Source§

type IntoIter = IntoIter<<TimeSeries<T> as IntoIterator>::Item>

Which kind of iterator are we turning this into?
Source§

fn into_iter(self) -> Self::IntoIter

Creates an iterator from a value. Read more
Source§

impl<T> Mul<&TimeSeries<T>> for &TimeSeries<T>
where for<'a> &'a T: Mul<Output = T>, TimeSeries<T>: Clone,

Source§

type Output = TimeSeries<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: &TimeSeries<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<&TimeSeries<T>> for TimeSeries<T>
where for<'a> &'a T: Mul<Output = T>,

Source§

type Output = TimeSeries<T>

The resulting type after applying the * operator.
Source§

fn mul(self, other: &Self) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul<TimeSeries<T>> for &TimeSeries<T>
where for<'a> &'a T: Mul<Output = T>, TimeSeries<T>: Clone,

Source§

type Output = TimeSeries<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: TimeSeries<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> Mul for TimeSeries<T>
where for<'a> &'a T: Mul<Output = T>,

Source§

type Output = TimeSeries<T>

The resulting type after applying the * operator.
Source§

fn mul(self, rhs: TimeSeries<T>) -> Self::Output

Performs the * operation. Read more
Source§

impl<T> MulAssign<&TimeSeries<T>> for TimeSeries<T>
where for<'a> &'a T: Mul<Output = T>, TimeSeries<T>: Default,

Source§

fn mul_assign(&mut self, rhs: &TimeSeries<T>)

Performs the *= operation. Read more
Source§

impl<T> MulAssign for TimeSeries<T>
where for<'a> &'a T: Mul<Output = T>, TimeSeries<T>: Default,

Source§

fn mul_assign(&mut self, rhs: TimeSeries<T>)

Performs the *= operation. Read more
Source§

impl<T> Sub<&TimeSeries<T>> for &TimeSeries<T>
where for<'a> &'a T: Sub<Output = T>, TimeSeries<T>: Clone,

Source§

type Output = TimeSeries<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: &TimeSeries<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<&TimeSeries<T>> for TimeSeries<T>
where for<'a> &'a T: Sub<Output = T>,

Source§

type Output = TimeSeries<T>

The resulting type after applying the - operator.
Source§

fn sub(self, other: &Self) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub<TimeSeries<T>> for &TimeSeries<T>
where for<'a> &'a T: Sub<Output = T>, TimeSeries<T>: Clone,

Source§

type Output = TimeSeries<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: TimeSeries<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> Sub for TimeSeries<T>
where for<'a> &'a T: Sub<Output = T>,

Source§

type Output = TimeSeries<T>

The resulting type after applying the - operator.
Source§

fn sub(self, rhs: TimeSeries<T>) -> Self::Output

Performs the - operation. Read more
Source§

impl<T> SubAssign<&TimeSeries<T>> for TimeSeries<T>
where for<'a> &'a T: Sub<Output = T>, TimeSeries<T>: Default,

Source§

fn sub_assign(&mut self, rhs: &TimeSeries<T>)

Performs the -= operation. Read more
Source§

impl<T> SubAssign for TimeSeries<T>
where for<'a> &'a T: Sub<Output = T>, TimeSeries<T>: Default,

Source§

fn sub_assign(&mut self, rhs: TimeSeries<T>)

Performs the -= operation. Read more
Source§

impl<T> Variation for TimeSeries<T>
where T: Clone, for<'a, 'a, 'a, 'a> &'a T: Add<Output = T> + Sub<Output = T> + Mul<Output = T> + Div<Output = T>,

Source§

fn diff(&self, offset: usize) -> Self

Source§

fn pct_change(&self, offset: usize) -> Self

Auto Trait Implementations§

§

impl<T> Freeze for TimeSeries<T>

§

impl<T> RefUnwindSafe for TimeSeries<T>
where T: RefUnwindSafe,

§

impl<T> Send for TimeSeries<T>
where T: Send,

§

impl<T> Sync for TimeSeries<T>
where T: Sync,

§

impl<T> Unpin for TimeSeries<T>
where T: Unpin,

§

impl<T> UnwindSafe for TimeSeries<T>
where T: UnwindSafe,

Blanket Implementations§

Source§

impl<T> Any for T
where T: 'static + ?Sized,

Source§

fn type_id(&self) -> TypeId

Gets the TypeId of self. Read more
Source§

impl<T> Borrow<T> for T
where T: ?Sized,

Source§

fn borrow(&self) -> &T

Immutably borrows from an owned value. Read more
Source§

impl<T> BorrowMut<T> for T
where T: ?Sized,

Source§

fn borrow_mut(&mut self) -> &mut T

Mutably borrows from an owned value. Read more
Source§

impl<T> CloneToUninit for T
where T: Clone,

Source§

unsafe fn clone_to_uninit(&self, dest: *mut u8)

🔬This is a nightly-only experimental API. (clone_to_uninit)
Performs copy-assignment from self to dest. Read more
Source§

impl<T> From<T> for T

Source§

fn from(t: T) -> T

Returns the argument unchanged.

Source§

impl<T, U> Into<U> for T
where U: From<T>,

Source§

fn into(self) -> U

Calls U::from(self).

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

Source§

impl<T> ToOwned for T
where T: Clone,

Source§

type Owned = T

The resulting type after obtaining ownership.
Source§

fn to_owned(&self) -> T

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

fn clone_into(&self, target: &mut T)

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

impl<T, U> TryFrom<U> for T
where U: Into<T>,

Source§

type Error = Infallible

The type returned in the event of a conversion error.
Source§

fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>

Performs the conversion.
Source§

impl<T, U> TryInto<U> for T
where U: TryFrom<T>,

Source§

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.
Source§

fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>

Performs the conversion.