Trait yata::core::Sequence

source ·
pub trait Sequence<T>: AsRef<[T]> {
    // Required method
    fn validate(&self) -> bool;

    // Provided methods
    fn call<M>(&self, method: &mut M) -> Vec<M::Output>
       where M: Method<Input = T> { ... }
    fn apply<M>(&mut self, method: &mut M)
       where M: Method<Input = T, Output = T>,
             Self: AsMut<[T]> { ... }
    fn get_initial_value(&self) -> Option<&T> { ... }
    fn get_initial_value_mut(&mut self) -> Option<&mut T>
       where Self: AsMut<[T]> { ... }
    fn collapse_timeframe(&self, size: usize, continuous: bool) -> Vec<T>
       where T: OHLCV + Clone + Add<Output = T> { ... }
}
Expand description

Implements some methods for sequence manipulations.

Required Methods§

source

fn validate(&self) -> bool

Validates the sequence.

Provided Methods§

source

fn call<M>(&self, method: &mut M) -> Vec<M::Output>
where M: Method<Input = T>,

Calls Method over the slice and returns Vec of result values.

source

fn apply<M>(&mut self, method: &mut M)
where M: Method<Input = T, Output = T>, Self: AsMut<[T]>,

Applies Method on the slice in-place.

source

fn get_initial_value(&self) -> Option<&T>

Returns a reference to the first value in the sequence or None if it’s empty.

source

fn get_initial_value_mut(&mut self) -> Option<&mut T>
where Self: AsMut<[T]>,

Returns a reference to the first value in the sequence or None if it’s empty.

source

fn collapse_timeframe(&self, size: usize, continuous: bool) -> Vec<T>
where T: OHLCV + Clone + Add<Output = T>,

Converts timeframe of the series

See also CollapseTimeframe method.

Object Safety§

This trait is not object safe.

Implementors§

source§

impl<Q: AsRef<[ValueType]>> Sequence<f64> for Q

source§

impl<T: OHLCV, Q: AsRef<[T]>> Sequence<T> for Q