pub trait LttbSource {
    type Item;

    // Required methods
    fn len(&self) -> usize;
    fn item_at(&self, i: usize) -> Self::Item;

    // Provided methods
    fn is_empty(&self) -> bool { ... }
    fn cast<T, F>(self, f: F) -> Cast<Self, T, F>
       where Self: Sized,
             T: DataPoint,
             F: Fn(Self::Item) -> T { ... }
    fn lttb(self, threshold: usize) -> LttbIterator<Self> 
       where Self: Sized,
             Self::Item: DataPoint { ... }
}
Expand description

data source for lttb sampling

Known limitations

  • X-values must be in a strictly increasing order

Required Associated Types§

source

type Item

data item of LttbSource

Required Methods§

source

fn len(&self) -> usize

length of LttbSource

source

fn item_at(&self, i: usize) -> Self::Item

data item at index i

Provided Methods§

source

fn is_empty(&self) -> bool

is LttbSource empty

source

fn cast<T, F>(self, f: F) -> Cast<Self, T, F>where Self: Sized, T: DataPoint, F: Fn(Self::Item) -> T,

map data item to another type.

  • if the data item type of LttbSource is not DataPoint, lttb sampling can be used after casting
source

fn lttb(self, threshold: usize) -> LttbIterator<Self> where Self: Sized, Self::Item: DataPoint,

lttb sampling

Implementations on Foreign Types§

source§

impl<'a, S: LttbSource> LttbSource for &'a S

§

type Item = <S as LttbSource>::Item

source§

fn len(&self) -> usize

source§

fn item_at(&self, i: usize) -> Self::Item

source§

impl<'a, T> LttbSource for &'a [T]

§

type Item = &'a T

source§

fn len(&self) -> usize

source§

fn item_at(&self, i: usize) -> Self::Item

source§

impl<T: Clone> LttbSource for [T]

§

type Item = T

source§

fn len(&self) -> usize

source§

fn item_at(&self, i: usize) -> Self::Item

Implementors§

source§

impl<S, T, F> LttbSource for Cast<S, T, F>where S: LttbSource, T: DataPoint, F: Fn(S::Item) -> T,

§

type Item = T