[−][src]Trait spacebattleship::ships::ShipShape
Trait for shapes that a ship can be.
Associated Types
type ProjectIterState: ProjectIterState<D, ShipShape = Self>
Required methods
fn is_valid_placement(
&self,
proj: &ShapeProjection<D::Coordinate>,
dim: &D
) -> bool
&self,
proj: &ShapeProjection<D::Coordinate>,
dim: &D
) -> bool
Return true if the given shape projection is a valid placement of this ship in the specified dimensions. Does not account for whether cells are already occupied. Shapes are free to reject any placement that they did not generate.
Provided methods
fn project<'a>(
&'a self,
coord: D::Coordinate,
dim: &'a D
) -> ProjectIter<D, Self::ProjectIterState>
&'a self,
coord: D::Coordinate,
dim: &'a D
) -> ProjectIter<D, Self::ProjectIterState>
Get an iterator over possible placements of this ship shap in the given dimensions. Does not in any way account for whether cells are already occupied or not.
Implementors
impl<D: Dimensions + ColinearCheck + ?Sized> ShipShape<D> for Line
[src]
type ProjectIterState = LineProjectIterState<D::Coordinate>
fn is_valid_placement(
&self,
proj: &ShapeProjection<D::Coordinate>,
dim: &D
) -> bool
[src]
&self,
proj: &ShapeProjection<D::Coordinate>,
dim: &D
) -> bool