pub trait Grid: Debug {
type OccupiedIterator<'a>: IntoIterator<Item = &'a Cell>
where Cell: 'a,
Self: 'a;
type CornerIterator<'a>: IntoIterator<Item = (&'a Cell, &'a CornerStatus)>
where Cell: 'a,
CornerStatus: 'a,
Self: 'a;
// Required methods
fn change_cells(
&mut self,
changes: &HashMap<Cell, bool>,
) -> (Vec<(Cell, bool)>, Vec<(Cell, CornerStatus)>);
fn cell_size(&self) -> f64;
fn is_occupied(&self, cell: &Cell) -> bool;
fn occupied_cells<'b>(&'b self) -> Self::OccupiedIterator<'b>;
fn corners<'b>(&'b self) -> Self::CornerIterator<'b>;
fn is_point_occupied(&self, p: Point) -> Option<Cell>;
fn is_square_occupied(&self, p: Point, width: f64) -> Option<Cell>;
fn is_circle_occupied(&self, p: Point, radius: f64) -> Option<Cell>;
fn is_sweep_occupied(
&self,
p0: Point,
p1: Point,
width: f64,
) -> Option<Cell>;
}Required Associated Types§
type OccupiedIterator<'a>: IntoIterator<Item = &'a Cell> where Cell: 'a, Self: 'a
type CornerIterator<'a>: IntoIterator<Item = (&'a Cell, &'a CornerStatus)> where Cell: 'a, CornerStatus: 'a, Self: 'a
Required Methods§
Sourcefn change_cells(
&mut self,
changes: &HashMap<Cell, bool>,
) -> (Vec<(Cell, bool)>, Vec<(Cell, CornerStatus)>)
fn change_cells( &mut self, changes: &HashMap<Cell, bool>, ) -> (Vec<(Cell, bool)>, Vec<(Cell, CornerStatus)>)
Change the occupancy value of a set of cells. Get back any changes that have occurred to the corners of the occupancy.
Sourcefn is_occupied(&self, cell: &Cell) -> bool
fn is_occupied(&self, cell: &Cell) -> bool
Check if a single cell is occupied.
Sourcefn occupied_cells<'b>(&'b self) -> Self::OccupiedIterator<'b>
fn occupied_cells<'b>(&'b self) -> Self::OccupiedIterator<'b>
Get an iterator over all occupied cells.
Sourcefn corners<'b>(&'b self) -> Self::CornerIterator<'b>
fn corners<'b>(&'b self) -> Self::CornerIterator<'b>
Get an iterator over all corners.
Sourcefn is_point_occupied(&self, p: Point) -> Option<Cell>
fn is_point_occupied(&self, p: Point) -> Option<Cell>
Check if a point is occupied. If it is, return the cell that occupies it.
Sourcefn is_square_occupied(&self, p: Point, width: f64) -> Option<Cell>
fn is_square_occupied(&self, p: Point, width: f64) -> Option<Cell>
Check if a square has any occupancy. The first cell found that occupies the space will be returned.
Sourcefn is_circle_occupied(&self, p: Point, radius: f64) -> Option<Cell>
fn is_circle_occupied(&self, p: Point, radius: f64) -> Option<Cell>
Check if a circle has any occupancy. The first cell found that occupies the circle will be returned.
Sourcefn is_sweep_occupied(&self, p0: Point, p1: Point, width: f64) -> Option<Cell>
fn is_sweep_occupied(&self, p0: Point, p1: Point, width: f64) -> Option<Cell>
Check if a rectangular sweep from p0 to p1 with the specified width has any occupancy. The first cell found that occupies the space will be returned.
If p0 is almost equal to p1 then this will simply return the result of is_point_occupied(p0), because there is no way to infer what direction is meant to span the width of the sweep.
Dyn Compatibility§
This trait is not dyn compatible.
In older versions of Rust, dyn compatibility was called "object safety", so this trait is not object safe.