use std::default::Default; use crate::VectorGrid; impl VectorGrid { fn _insert_column(&mut self, at_x: usize) { self.width = self.width.saturating_add(1); let mut i = at_x; while i < self.items.len() { self.items.insert(i, Default::default()); i += self.width.get() } } pub fn extend_left(&mut self, amount: usize) { let mut i = 0; self.width = self.width.saturating_add(amount); while i < self.items.len() { self.items .splice(i..i, vec![Default::default(); amount]); i += self.width.get(); } } pub fn extend_right(&mut self, amount: usize) { let mut i = self.width.get(); self.width = self.width.saturating_add(amount); while i < self.items.len() { self.items .splice(i..i, vec![Default::default(); amount]); i += self.width.get(); } } pub fn extend_bottom(&mut self, amount: usize) { self.items.splice(0..0, vec![Default::default(); amount * self.width.get()]); } pub fn extend(&mut self, amount: usize) { self.items.extend(vec![Default::default(); amount]) } }