pub struct Grid { /* private fields */ }Expand description
A rectangular 4-connected grid. Cells are vertices in row-major order,
y * width + x; blocked cells are vertices without edges.
Implementations§
Source§impl Grid
impl Grid
Trait Implementations§
impl Eq for Grid
Source§impl OrientedGraph for Grid
A grid as an OrientedGraph: four headings (Grid::EAST, Grid::NORTH,
Grid::WEST, Grid::SOUTH, counter-clockwise), and a turn is a quarter turn either
way, counter-clockwise first.
impl OrientedGraph for Grid
A grid as an OrientedGraph: four headings (Grid::EAST, Grid::NORTH,
Grid::WEST, Grid::SOUTH, counter-clockwise), and a turn is a quarter turn either
way, counter-clockwise first.
§Examples
use mapf_search::{Grid, OrientedGraph};
let grid = Grid::parse(&["..", "@."]);
assert_eq!(grid.forward(grid.vertex(0, 0), Grid::EAST), Some(grid.vertex(1, 0)));
assert_eq!(grid.forward(grid.vertex(0, 0), Grid::SOUTH), None);
let mut turns = Vec::new();
grid.turns(Grid::EAST, |heading| turns.push(heading));
assert_eq!(turns, [Grid::NORTH, Grid::SOUTH]);Source§fn heading_count(&self) -> usize
fn heading_count(&self) -> usize
The number of headings. Headings are
0..heading_count(), the same at every vertex.impl StructuralPartialEq for Grid
Auto Trait Implementations§
impl Forget for Grid
impl Freeze for Grid
impl Move for Grid
impl RefUnwindSafe for Grid
impl Send for Grid
impl Sync for Grid
impl Unpin for Grid
impl UnsafeUnpin for Grid
impl UnwindSafe for Grid
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