Struct distance_transform::grid::GenericGrid
[−]
[src]
pub struct GenericGrid<T> { /* fields omitted */ }
A two-dimensional grid of an arbitrary type T
Methods
impl<T: Default + Clone> GenericGrid<T>
[src]
fn new(width: usize, height: usize) -> GenericGrid<T>
[src]
Constructs a new two-dimensional GenericGrid<T>
of size width
xheight
with default values of type T
.
fn height(&self) -> usize
[src]
Returns the width of the grid
fn width(&self) -> usize
[src]
Returns the height of the grid
fn get(&self, x: usize, y: usize) -> Option<&T>
[src]
Returns the element at position (x, y), or None
if the position
is out of bounds.
fn get_unchecked(&self, x: usize, y: usize) -> &T
[src]
Returns a pointer to the element at position (x, y), without doing bounds checking.
fn set(&mut self, x: usize, y: usize, value: T)
[src]
Sets the value of the grid at position (x,y)
fn to_vec(self) -> Vec<T>
[src]
Converts the GenericGrid<T>
to a Vec<T>
with indexing
grid[x, y] == vec[y*grid.width + x]
fn iter(&self) -> GridIter<T>
[src]
Returns an iterator over the nodes of the grid.
An item of the iterator contains the position
and a reference to the node: (x, y, value)
fn iter_mut(&mut self) -> GridIterMut<T>
[src]
Returns an iterator over the nodes of the grid.
An item of the iterator contains the position
and a mutable reference to the node: (x, y, value)
Trait Implementations
impl<T: Debug> Debug for GenericGrid<T>
[src]
impl<T: Clone> Clone for GenericGrid<T>
[src]
fn clone(&self) -> GenericGrid<T>
[src]
Returns a copy of the value. Read more
fn clone_from(&mut self, source: &Self)
1.0.0[src]
Performs copy-assignment from source
. Read more