fix oldest samples not being removed
This commit is contained in:
parent
d22e5659fc
commit
39074c3c0b
|
|
@ -12,10 +12,11 @@ impl Container {
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn push(&mut self, data: Vec<f32>) {
|
pub fn push(&mut self, data: Vec<f32>) {
|
||||||
|
self.data.push(data);
|
||||||
|
|
||||||
if self.data.len() as u32 > self.max_samples {
|
if self.data.len() as u32 > self.max_samples {
|
||||||
self.data.pop();
|
self.data.remove(0);
|
||||||
}
|
}
|
||||||
self.data.push(data)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
pub fn iter(&self) -> std::slice::Iter<'_, Vec<f32>> {
|
pub fn iter(&self) -> std::slice::Iter<'_, Vec<f32>> {
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue