[][src]Struct spacebattleship::board::ShipRef

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

Handle to a ship that allows getting information about its status.

Implementations

impl<'a, I: ShipId, D: Dimensions> ShipRef<'a, I, D>[src]

pub fn id(&self) -> &'a I[src]

Get the ID of the ship.

pub fn sunk(&self) -> bool[src]

Check if this ship has been sunk.

pub fn coords(&self) -> impl 'a + Iterator<Item = &'a D::Coordinate>[src]

Get an iterator over the coordinates of this ship.

pub fn hits(&self) -> impl 'a + Iterator<Item = (&'a D::Coordinate, bool)>[src]

Get an iterator over the coordinates of this ship and whether those coords have been hit.

Trait Implementations

impl<'_, I, D: Dimensions> Clone for ShipRef<'_, I, D>[src]

impl<'_, I, D: Dimensions> Copy for ShipRef<'_, I, D>[src]

impl<'a, I: Debug, D: Debug + Dimensions> Debug for ShipRef<'a, I, D> where
    D::Coordinate: Debug
[src]

Auto Trait Implementations

impl<'a, I, D> RefUnwindSafe for ShipRef<'a, I, D> where
    D: RefUnwindSafe,
    I: RefUnwindSafe,
    <D as Dimensions>::Coordinate: RefUnwindSafe

impl<'a, I, D> Send for ShipRef<'a, I, D> where
    D: Sync,
    I: Sync,
    <D as Dimensions>::Coordinate: Sync

impl<'a, I, D> Sync for ShipRef<'a, I, D> where
    D: Sync,
    I: Sync,
    <D as Dimensions>::Coordinate: Sync

impl<'a, I, D> Unpin for ShipRef<'a, I, D>

impl<'a, I, D> UnwindSafe for ShipRef<'a, I, D> where
    D: RefUnwindSafe,
    I: 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> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

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.