Trait LttbSource

Source
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

Source§

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]

Source§

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]

Source§

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,

Source§

type Item = T