2026-06-10 23:35:13 +02:00
|
|
|
pub struct Container {
|
|
|
|
|
max_samples: u32,
|
2026-06-14 21:16:55 +02:00
|
|
|
data: Vec<Vec<f32>>,
|
2026-06-10 23:35:13 +02:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
impl Container {
|
|
|
|
|
pub fn new(max_samples: u32) -> Container {
|
|
|
|
|
Container {
|
|
|
|
|
max_samples: max_samples,
|
|
|
|
|
data: vec![],
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
pub fn push(&mut self, data: Vec<f32>) {
|
2026-06-25 23:22:18 +02:00
|
|
|
self.data.push(data);
|
|
|
|
|
|
2026-06-10 23:35:13 +02:00
|
|
|
if self.data.len() as u32 > self.max_samples {
|
2026-06-25 23:22:18 +02:00
|
|
|
self.data.remove(0);
|
2026-06-10 23:35:13 +02:00
|
|
|
}
|
|
|
|
|
}
|
2026-06-14 21:16:55 +02:00
|
|
|
|
|
|
|
|
pub fn iter(&self) -> std::slice::Iter<'_, Vec<f32>> {
|
|
|
|
|
self.data.iter()
|
|
|
|
|
}
|
2026-06-10 23:35:13 +02:00
|
|
|
}
|