ThinGridData: avoid clones

This commit is contained in:
Simon Gardling 2025-03-24 17:04:21 -04:00
parent 56f3eae156
commit 70354a4111
Signed by: titaniumtown
GPG Key ID: 9AB28AC10ECE533D
2 changed files with 2 additions and 3 deletions

View File

@ -21,8 +21,7 @@ impl ThinGridData {
}
}
#[allow(dead_code)]
pub fn new_from_grid_vec(in_grids: Vec<Grid>) -> Vec<Self> {
pub fn new_from_grid_vec(in_grids: &[Grid]) -> Vec<Self> {
in_grids
.iter()
.map(|grid| Self::new_from_grid(grid))

View File

@ -148,7 +148,7 @@ impl Model {
}
fn save_image_data(&mut self) {
let grids = ThinGridData::new_from_grid_vec(self.population_grids.clone());
let grids = ThinGridData::new_from_grid_vec(&self.population_grids);
let img_data = ImgData::new(grids, self.palette);
self.img_data_vec.push((self.iteration + 1, img_data));
let size: usize = std::mem::size_of_val(&self.img_data_vec);