pub struct SeriesBuffer<T> { /* private fields */ }Expand description
A capped window of past values, newest first.
Implementations§
Source§impl<T> SeriesBuffer<T>
impl<T> SeriesBuffer<T>
Sourcepub fn push(&mut self, value: T, capacity: usize)
pub fn push(&mut self, value: T, capacity: usize)
Record this bar’s value, retaining at most capacity of them.
Sourcepub fn get(&self, offset: usize) -> Option<&T>
pub fn get(&self, offset: usize) -> Option<&T>
The value offset bars back, or None if the buffer has not seen that
many bars yet. offset 0 is the current bar.
pub fn is_empty(&self) -> bool
Source§impl SeriesBuffer<f64>
impl SeriesBuffer<f64>
Sourcepub fn window(&self, n: usize) -> Vec<f64>
pub fn window(&self, n: usize) -> Vec<f64>
The newest n values, newest first. Shorter than n while warming up.
Sourcepub fn observe(&mut self, value: f64, length: usize) -> Option<Vec<f64>>
pub fn observe(&mut self, value: f64, length: usize) -> Option<Vec<f64>>
Record this bar’s value and return the length values to compute over,
newest first — or None while fewer than length bars have been seen.
Pine yields na until a series has enough history to answer, so warming up is the buffer’s business rather than each builtin’s.
Trait Implementations§
Source§impl<T: Clone> Clone for SeriesBuffer<T>
impl<T: Clone> Clone for SeriesBuffer<T>
Source§fn clone(&self) -> SeriesBuffer<T>
fn clone(&self) -> SeriesBuffer<T>
Returns a duplicate of the value. Read more
1.0.0 (const: unstable) · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl<T: Debug> Debug for SeriesBuffer<T>
impl<T: Debug> Debug for SeriesBuffer<T>
Auto Trait Implementations§
impl<T> Freeze for SeriesBuffer<T>
impl<T> RefUnwindSafe for SeriesBuffer<T>where
T: RefUnwindSafe,
impl<T> Send for SeriesBuffer<T>where
T: Send,
impl<T> Sync for SeriesBuffer<T>where
T: Sync,
impl<T> Unpin for SeriesBuffer<T>where
T: Unpin,
impl<T> UnsafeUnpin for SeriesBuffer<T>
impl<T> UnwindSafe for SeriesBuffer<T>where
T: UnwindSafe,
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