pub struct SmoothBuffer<const CAP: usize, T: Num> { /* private fields */ }
Expand description
Simple fixed size ringbuffer with fast averaging.
Implementations§
Source§impl<const CAP: usize, T: Num> SmoothBuffer<CAP, T>
impl<const CAP: usize, T: Num> SmoothBuffer<CAP, T>
Sourcepub fn pre_filled(value: T) -> Self
pub fn pre_filled(value: T) -> Self
Creates a new buffer pre-populated with a value, filled to capacity.
Sourcepub fn capacity(&self) -> usize
pub fn capacity(&self) -> usize
The maximum number of items. Older items are discarded in favor of newer ones if capacity is exceeded.
Sourcepub fn push_slice(&mut self, slice: &[T])
pub fn push_slice(&mut self, slice: &[T])
Pushes multiple values at once.
Source§impl<const CAP: usize, T: Float> SmoothBuffer<CAP, T>
impl<const CAP: usize, T: Float> SmoothBuffer<CAP, T>
Sourcepub fn gaussian_filter(&self) -> T
pub fn gaussian_filter(&self) -> T
Gaussian smoothing. Much slower than a simple average, will actually iterate through all values and return a weighted sum.
Trait Implementations§
Auto Trait Implementations§
impl<const CAP: usize, T> Freeze for SmoothBuffer<CAP, T>where
T: Freeze,
impl<const CAP: usize, T> RefUnwindSafe for SmoothBuffer<CAP, T>where
T: RefUnwindSafe,
impl<const CAP: usize, T> Send for SmoothBuffer<CAP, T>where
T: Send,
impl<const CAP: usize, T> Sync for SmoothBuffer<CAP, T>where
T: Sync,
impl<const CAP: usize, T> Unpin for SmoothBuffer<CAP, T>where
T: Unpin,
impl<const CAP: usize, T> UnwindSafe for SmoothBuffer<CAP, 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