[−][src]Struct spacebattleship::board::Board
Represents a single player's board, including their ships and their side of the ocean.
Implementations
impl<I: ShipId, D: Dimensions> Board<I, D>
[src]
pub fn dimensions(&self) -> &D
[src]
Get the [Dimesnsions
] of this Board
.
pub fn defeated(&self) -> bool
[src]
Returns true if all of this player's ships have been sunk.
pub fn iter_ships(&self) -> impl Iterator<Item = ShipRef<I, D>>
[src]
Get an iterator over all ships on this board.
pub fn get_ship<Q: ?Sized>(&self, ship: &Q) -> Option<ShipRef<I, D>> where
I: Borrow<Q>,
Q: Hash + Eq,
[src]
I: Borrow<Q>,
Q: Hash + Eq,
Get the ship with the specified ID if it exists.
pub fn get_coord(&self, coord: D::Coordinate) -> Option<CellRef<I, D>>
[src]
Get a reference to the cell at the given coordinate. Returns None if the coordinate is out of bounds.
pub fn shoot(
&mut self,
coord: D::Coordinate
) -> Result<ShotOutcome<I>, ShotError<D::Coordinate>>
[src]
&mut self,
coord: D::Coordinate
) -> Result<ShotOutcome<I>, ShotError<D::Coordinate>>
Fire a shot at this player, returning a result indicating why the shot was aborted or the result of the shot on this player.
Auto Trait Implementations
impl<I, D> RefUnwindSafe for Board<I, D> where
D: RefUnwindSafe,
I: RefUnwindSafe,
<D as Dimensions>::Coordinate: RefUnwindSafe,
D: RefUnwindSafe,
I: RefUnwindSafe,
<D as Dimensions>::Coordinate: RefUnwindSafe,
impl<I, D> Send for Board<I, D> where
D: Send,
I: Send,
<D as Dimensions>::Coordinate: Send,
D: Send,
I: Send,
<D as Dimensions>::Coordinate: Send,
impl<I, D> Sync for Board<I, D> where
D: Sync,
I: Sync,
<D as Dimensions>::Coordinate: Sync,
D: Sync,
I: Sync,
<D as Dimensions>::Coordinate: Sync,
impl<I, D> Unpin for Board<I, D> where
D: Unpin,
I: Unpin,
<D as Dimensions>::Coordinate: Unpin,
D: Unpin,
I: Unpin,
<D as Dimensions>::Coordinate: Unpin,
impl<I, D> UnwindSafe for Board<I, D> where
D: UnwindSafe,
I: UnwindSafe,
<D as Dimensions>::Coordinate: UnwindSafe,
D: UnwindSafe,
I: UnwindSafe,
<D as Dimensions>::Coordinate: UnwindSafe,
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>,