[][src]Enum spacebattleship::game::uniform::ShotOutcome

pub enum ShotOutcome<I> {
    Miss,
    Hit(I),
    Sunk(I),
    Defeated(I),
    Victory(I),
}

Result of a shot on a single player's board.

Variants

Miss

The shot did not hit anything.

Hit(I)

The shot hit the ship with the given ID, but did not sink it.

Sunk(I)

The shot hit the ship with the given ID, but the player has more ships left.

Defeated(I)

The shot hit the ship with the given ID, and all of the player's ships are now sunk. However, there are additonal players left who still have ships.

Victory(I)

The shot hit the ship with the given ID and all players but the current player are now defeated. The current player is the winner.

Implementations

impl<I> ShotOutcome<I>[src]

pub fn ship(&self) -> Option<&I>[src]

Get the id of the ship that was hit.

pub fn into_ship(self) -> Option<I>[src]

Extract the id of the ship that was hit from this result.

Trait Implementations

impl<I> From<ShotOutcome<I>> for ShotOutcome<I>[src]

Auto Trait Implementations

impl<I> RefUnwindSafe for ShotOutcome<I> where
    I: RefUnwindSafe

impl<I> Send for ShotOutcome<I> where
    I: Send

impl<I> Sync for ShotOutcome<I> where
    I: Sync

impl<I> Unpin for ShotOutcome<I> where
    I: Unpin

impl<I> UnwindSafe for ShotOutcome<I> where
    I: 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.