pub struct SimpleGrid<T: Clone + Copy> {
pub width: usize,
pub height: usize,
pub values: Vec<T>,
}
Fields§
§width: usize
§height: usize
§values: Vec<T>
Trait Implementations§
Source§impl<T: Clone + Clone + Copy> Clone for SimpleGrid<T>
impl<T: Clone + Clone + Copy> Clone for SimpleGrid<T>
Source§fn clone(&self) -> SimpleGrid<T>
fn clone(&self) -> SimpleGrid<T>
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source
. Read moreSource§impl<T: Default + Clone + Copy> Default for SimpleGrid<T>
impl<T: Default + Clone + Copy> 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>
impl<'de, T> Deserialize<'de> for SimpleGrid<T>
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: Clone + Copy> Grid<T> for SimpleGrid<T>
impl<T: Clone + Copy> Grid<T> for SimpleGrid<T>
fn new(width: usize, height: usize, default_value: T) -> Self
fn get(&self, x: usize, y: usize) -> T
fn set(&mut self, x: usize, y: usize, value: T)
fn width(&self) -> usize
fn height(&self) -> usize
fn get_point(&self, point: Point) -> T
fn set_point(&mut self, point: Point, value: T)
Source§fn get_ix(&self, x: usize, y: usize) -> usize
fn get_ix(&self, x: usize, y: usize) -> usize
Gets the index corresponding to a coordinate, which is row-wise.
fn get_ix_point(&self, point: &Point) -> usize
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_rectangle(&mut self, rect: &Rect, value: T)
fn set_rectangle(&mut self, rect: &Rect, value: T)
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