pub struct RingBuffer<T, const N: usize> { /* private fields */ }Expand description
A fixed-size circular buffer for storing numerical samples.
Implementations§
Source§impl<T: Default + Copy, const N: usize> RingBuffer<T, N>
impl<T: Default + Copy, const N: usize> RingBuffer<T, N>
Source§impl<const N: usize> RingBuffer<f32, N>
impl<const N: usize> RingBuffer<f32, N>
Sourcepub fn trend(&self) -> f32
pub fn trend(&self) -> f32
Calculates the trend (slope) based on a simple linear regression or just the difference between first and last half. Returns positive if increasing, negative if decreasing.
Trait Implementations§
Source§impl<T: Clone, const N: usize> Clone for RingBuffer<T, N>
impl<T: Clone, const N: usize> Clone for RingBuffer<T, N>
Source§fn clone(&self) -> RingBuffer<T, N>
fn clone(&self) -> RingBuffer<T, N>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreAuto Trait Implementations§
impl<T, const N: usize> Freeze for RingBuffer<T, N>where
T: Freeze,
impl<T, const N: usize> RefUnwindSafe for RingBuffer<T, N>where
T: RefUnwindSafe,
impl<T, const N: usize> Send for RingBuffer<T, N>where
T: Send,
impl<T, const N: usize> Sync for RingBuffer<T, N>where
T: Sync,
impl<T, const N: usize> Unpin for RingBuffer<T, N>where
T: Unpin,
impl<T, const N: usize> UnwindSafe for RingBuffer<T, N>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