pub struct Resampler<T: Div<Output = T> + Sum + PartialOrd + FromPrimitive + Default + Debug, S: Sample<Value = T>> { /* private fields */ }Expand description
The Resampler struct is used to resample a time series of samples. It stores the samples in a buffer and resamples the samples in the buffer when the resample method is called. A resampler can be configured with a resampling function and a resampling interval.
Implementations§
Source§impl<T: Div<Output = T> + Sum + PartialOrd + FromPrimitive + Default + Debug, S: Sample<Value = T>> Resampler<T, S>
impl<T: Div<Output = T> + Sum + PartialOrd + FromPrimitive + Default + Debug, S: Sample<Value = T>> Resampler<T, S>
Sourcepub fn new(
interval: TimeDelta,
resampling_function: ResamplingFunction<T, S>,
max_age_in_intervals: i32,
start: DateTime<Utc>,
first_timestamp: bool,
) -> Self
pub fn new( interval: TimeDelta, resampling_function: ResamplingFunction<T, S>, max_age_in_intervals: i32, start: DateTime<Utc>, first_timestamp: bool, ) -> Self
Creates a new Resampler with the given resampling interval and resampling function.
Sourcepub fn resample(&mut self, end: DateTime<Utc>) -> Vec<S>
pub fn resample(&mut self, end: DateTime<Utc>) -> Vec<S>
Resamples the samples in the buffer and returns the resampled samples until the given end time.
Sourcepub fn resample_now(&mut self) -> Vec<S>
pub fn resample_now(&mut self) -> Vec<S>
Resamples the samples in the buffer and returns the resampled samples until now.
Trait Implementations§
Source§impl<T: Debug + Div<Output = T> + Sum + PartialOrd + FromPrimitive + Default + Debug, S: Debug + Sample<Value = T>> Debug for Resampler<T, S>
impl<T: Debug + Div<Output = T> + Sum + PartialOrd + FromPrimitive + Default + Debug, S: Debug + Sample<Value = T>> Debug for Resampler<T, S>
Source§impl<T: Default + Div<Output = T> + Sum + PartialOrd + FromPrimitive + Default + Debug, S: Default + Sample<Value = T>> Default for Resampler<T, S>
impl<T: Default + Div<Output = T> + Sum + PartialOrd + FromPrimitive + Default + Debug, S: Default + Sample<Value = T>> Default for Resampler<T, S>
Source§impl<T: Div<Output = T> + Sum + PartialOrd + FromPrimitive + Default + Debug, S: Sample<Value = T>> Extend<S> for Resampler<T, S>
impl<T: Div<Output = T> + Sum + PartialOrd + FromPrimitive + Default + Debug, S: Sample<Value = T>> Extend<S> for Resampler<T, S>
Source§fn extend<I: IntoIterator<Item = S>>(&mut self, iter: I)
fn extend<I: IntoIterator<Item = S>>(&mut self, iter: I)
Extends a collection with the contents of an iterator. Read more
§fn extend_one(&mut self, item: A)
fn extend_one(&mut self, item: A)
🔬This is a nightly-only experimental API. (
extend_one)Extends a collection with exactly one element.
§fn extend_reserve(&mut self, additional: usize)
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
Auto Trait Implementations§
impl<T, S> Freeze for Resampler<T, S>
impl<T, S> !RefUnwindSafe for Resampler<T, S>
impl<T, S> Send for Resampler<T, S>where
S: Send,
impl<T, S> Sync for Resampler<T, S>where
S: Sync,
impl<T, S> Unpin for Resampler<T, S>where
S: Unpin,
impl<T, S> !UnwindSafe for Resampler<T, S>
Blanket Implementations§
§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more