[−][src]Struct spacebattleship::board::setup::ShipEntry
Reference to a particular ship's placement info as well as the grid, providing access to the methods necessary to check it's placement status.
Implementations
impl<'a, I: ShipId, D: Dimensions, S: ShipShape<D>> ShipEntry<'a, I, D, S>
[src]
pub fn placement(&self) -> Option<&'a ShapeProjection<D::Coordinate>>
[src]
If the ship is placed, get the placement. Otherwise return None
.
impl<'a, I: ShipId, D: Dimensions, S: ShipShape<D>> ShipEntry<'a, I, D, S>
[src]
pub fn id(&self) -> &I
[src]
Get the ID of this ship.
pub fn placed(&self) -> bool
[src]
Returns true if this ship has been placed.
pub fn get_placements(
&self,
coord: D::Coordinate
) -> ProjectIter<D, S::ProjectIterState>
[src]
&self,
coord: D::Coordinate
) -> ProjectIter<D, S::ProjectIterState>
Get an interator over possible projections of the shape for this ship that
start from the given [Coordinate
]. If there are no possible placements
from the given coordinate, including if the coordinate is out of bounds,
the resulting iterator will be empty.
pub fn check_placement(
&self,
placement: &ShapeProjection<D::Coordinate>
) -> Result<(), CannotPlaceReason>
[src]
&self,
placement: &ShapeProjection<D::Coordinate>
) -> Result<(), CannotPlaceReason>
Check if the specified placement is valid for this ship.
Auto Trait Implementations
impl<'a, I, D, S> RefUnwindSafe for ShipEntry<'a, I, D, S> where
D: RefUnwindSafe,
I: RefUnwindSafe,
S: RefUnwindSafe,
<D as Dimensions>::Coordinate: RefUnwindSafe,
D: RefUnwindSafe,
I: RefUnwindSafe,
S: RefUnwindSafe,
<D as Dimensions>::Coordinate: RefUnwindSafe,
impl<'a, I, D, S> Send for ShipEntry<'a, I, D, S> where
D: Sync,
I: Send + Sync,
S: Sync,
<D as Dimensions>::Coordinate: Sync,
D: Sync,
I: Send + Sync,
S: Sync,
<D as Dimensions>::Coordinate: Sync,
impl<'a, I, D, S> Sync for ShipEntry<'a, I, D, S> where
D: Sync,
I: Sync,
S: Sync,
<D as Dimensions>::Coordinate: Sync,
D: Sync,
I: Sync,
S: Sync,
<D as Dimensions>::Coordinate: Sync,
impl<'a, I, D, S> Unpin for ShipEntry<'a, I, D, S> where
I: Unpin,
I: Unpin,
impl<'a, I, D, S> UnwindSafe for ShipEntry<'a, I, D, S> where
D: RefUnwindSafe,
I: RefUnwindSafe + UnwindSafe,
S: RefUnwindSafe,
<D as Dimensions>::Coordinate: RefUnwindSafe,
D: RefUnwindSafe,
I: RefUnwindSafe + UnwindSafe,
S: RefUnwindSafe,
<D as Dimensions>::Coordinate: RefUnwindSafe,
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,