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
Sourcepub fn parse(rows: &[&str]) -> Self
pub fn parse(rows: &[&str]) -> Self
Parses a grid from rows of text: . is free, @ is blocked.
All rows must have the same length. Moving AI maps use more symbols; their parser is planned separately.
§Panics
Panics if there are no rows, rows differ in length, or a row has another character.
Sourcepub fn is_blocked(&self, vertex: Vertex) -> bool
pub fn is_blocked(&self, vertex: Vertex) -> bool
Returns true if vertex is an obstacle.
Trait Implementations§
impl Eq for Grid
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