ThinGridData: avoid clones
This commit is contained in:
parent
56f3eae156
commit
70354a4111
@ -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))
|
||||
|
||||
@ -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);
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user