[][src]Struct spacebattleship::game::uniform::Game

pub struct Game<P: PlayerId, I: ShipId, D: Dimensions> { /* fields omitted */ }

Handles gameplay.

Implementations

impl<P: PlayerId, I: ShipId, D: Dimensions> Game<P, I, D>[src]

pub fn current(&self) -> &P[src]

Get the ID of the player whose turn it is.

pub fn winner(&self) -> Option<&P>[src]

Get the status of the game. Returns None if the game is in progress, otherwise returns the winner.

pub fn get_board<Q: ?Sized>(&self, pid: &Q) -> Option<&Board<I, D>> where
    P: Borrow<Q>,
    Q: Eq + Hash
[src]

Get a reference to the board for the specified player.

pub fn iter_boards(&self) -> impl Iterator<Item = (&P, &Board<I, D>)>[src]

Iterate the player ids and boards in turn-order.

pub fn shoot(
    &mut self,
    target: P,
    coord: D::Coordinate
) -> Result<ShotOutcome<I>, ShotError<P, D::Coordinate>>
[src]

Fire a shot at the specified player, returning the result of the shot or an error if the shot was invalid.

Auto Trait Implementations

impl<P, I, D> RefUnwindSafe for Game<P, I, D> where
    D: RefUnwindSafe,
    I: RefUnwindSafe,
    P: RefUnwindSafe,
    <D as Dimensions>::Coordinate: RefUnwindSafe

impl<P, I, D> Send for Game<P, I, D> where
    D: Send,
    I: Send,
    P: Send,
    <D as Dimensions>::Coordinate: Send

impl<P, I, D> Sync for Game<P, I, D> where
    D: Sync,
    I: Sync,
    P: Sync,
    <D as Dimensions>::Coordinate: Sync

impl<P, I, D> Unpin for Game<P, I, D> where
    D: Unpin,
    I: Unpin,
    P: Unpin,
    <D as Dimensions>::Coordinate: Unpin

impl<P, I, D> UnwindSafe for Game<P, I, D> where
    D: UnwindSafe,
    I: UnwindSafe,
    P: UnwindSafe,
    <D as Dimensions>::Coordinate: UnwindSafe

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.