pub struct SimpleGrid<T> {
pub width: usize,
pub height: usize,
pub values: Vec<T>,
}Expand description
Generic Grid implementation.
Fields§
§width: usize§height: usize§values: Vec<T>Trait Implementations§
Source§impl<T: Clone> Clone for SimpleGrid<T>
impl<T: Clone> Clone for SimpleGrid<T>
Source§impl<T: Debug> Debug for SimpleGrid<T>
impl<T: Debug> Debug for SimpleGrid<T>
Source§impl<T: Default> Default for SimpleGrid<T>
impl<T: Default> Default for SimpleGrid<T>
Source§fn default() -> SimpleGrid<T>
fn default() -> SimpleGrid<T>
Returns the “default value” for a type. Read more
Source§impl<'de, T> Deserialize<'de> for SimpleGrid<T>where
T: Deserialize<'de>,
impl<'de, T> Deserialize<'de> for SimpleGrid<T>where
T: Deserialize<'de>,
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
Source§impl<T> Grid<T> for SimpleGrid<T>
impl<T> Grid<T> for SimpleGrid<T>
fn new(width: usize, height: usize, default_value: T) -> Selfwhere
T: Clone,
fn get(&self, x: i32, y: i32) -> Option<&T>
fn get_mut(&mut self, x: i32, y: i32) -> Option<&mut T>
fn width(&self) -> usize
fn height(&self) -> usize
fn get_point(&self, point: Point) -> Option<&T>
fn get_ix(&self, ix: usize) -> Option<&T>
fn get_ix_point(&self, point: &Point) -> usize
Source§fn compute_ix(&self, x: i32, y: i32) -> usize
fn compute_ix(&self, x: i32, y: i32) -> usize
Gets the index corresponding to a coordinate, which is row-wise.
fn get_point_mut(&mut self, point: Point) -> Option<&mut T>
fn get_ix_mut(&mut self, ix: usize) -> Option<&mut T>
fn set(&mut self, x: i32, y: i32, value: T)
fn set_point(&mut self, point: Point, value: T)
fn set_ix(&mut self, ix: usize, value: T)
Source§fn point_in_bounds(&self, point: Point) -> bool
fn point_in_bounds(&self, point: Point) -> bool
Tests whether a point is in bounds.
Source§fn set_rect(&mut self, rect: Rect, value: T)where
T: Clone,
fn set_rect(&mut self, rect: Rect, value: T)where
T: Clone,
Sets a given rectangle on the grid to the value.
Auto Trait Implementations§
impl<T> Freeze for SimpleGrid<T>
impl<T> RefUnwindSafe for SimpleGrid<T>where
T: RefUnwindSafe,
impl<T> Send for SimpleGrid<T>where
T: Send,
impl<T> Sync for SimpleGrid<T>where
T: Sync,
impl<T> Unpin for SimpleGrid<T>where
T: Unpin,
impl<T> UnwindSafe for SimpleGrid<T>where
T: UnwindSafe,
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more