pub struct Resampler { /* private fields */ }Expand description
Resamples a chronologically ordered candle stream into coarser intervals.
Typical usage collects candles from either an in-memory vector or an async stream:
let resampled = Resampler::resample(candles, Interval::OneHour);Implementations§
Source§impl Resampler
impl Resampler
Sourcepub fn resample(candles: Vec<Candle>, interval: Interval) -> Vec<Candle>
pub fn resample(candles: Vec<Candle>, interval: Interval) -> Vec<Candle>
Convenience helper that processes the entire slice and returns the resampled candles.
Sourcepub async fn resample_stream<S>(
interval: Interval,
stream: &mut S,
) -> Vec<Candle>
pub async fn resample_stream<S>( interval: Interval, stream: &mut S, ) -> Vec<Candle>
Resample candles coming from an async stream.
Auto Trait Implementations§
impl Freeze for Resampler
impl RefUnwindSafe for Resampler
impl Send for Resampler
impl Sync for Resampler
impl Unpin for Resampler
impl UnwindSafe for Resampler
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more