[][src]Struct spacebattleship::board::setup::ShipEntry

pub struct ShipEntry<'a, I, D: Dimensions, S> { /* fields omitted */ }

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]

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]

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

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

impl<'a, I, D, S> Sync for ShipEntry<'a, I, D, S> where
    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

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

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.