pub struct Ubend { /* private fields */ }Expand description
Circular buffer implementation that matches the C Ubend structure
Implementations§
Source§impl Ubend
impl Ubend
Sourcepub fn new(capacity: usize) -> SpotResult<Self>
pub fn new(capacity: usize) -> SpotResult<Self>
Initialize a new Ubend with the given capacity
Sourcepub fn size(&self) -> usize
pub fn size(&self) -> usize
Get the current size of the container Returns capacity if filled, otherwise returns cursor position
Sourcepub fn push(&mut self, x: f64) -> f64
pub fn push(&mut self, x: f64) -> f64
Push a new value into the container Returns the value that was erased (if any), otherwise NaN
Sourcepub fn get(&self, index: usize) -> Option<f64>
pub fn get(&self, index: usize) -> Option<f64>
Get the data at a specific index in insertion order
Sourcepub fn last_erased_data(&self) -> f64
pub fn last_erased_data(&self) -> f64
Get last erased data
Trait Implementations§
Auto Trait Implementations§
impl Freeze for Ubend
impl RefUnwindSafe for Ubend
impl Send for Ubend
impl Sync for Ubend
impl Unpin for Ubend
impl UnwindSafe for Ubend
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