[][src]Enum sweeper::TileState

pub enum TileState<Cf> {
    ClosedEmpty(Flag<Cf>),
    OpenEmpty,
    OpenNumber(NonZeroU8),
    Mine(Flag<Cf>),
}

The state of a tile.

Variants

ClosedEmpty(Flag<Cf>)

A tile which is empty but hasn't been opened yet.

OpenEmpty

A tile which has been opened and doesn't have neighboring mines.

OpenNumber(NonZeroU8)

A tile which has been opened and has neighboring mines.

Mine(Flag<Cf>)

A tile which has a mine inside, and whether it's marked or not.

Methods

impl<Cf> TileState<Cf>[src]

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

Returns true if the tile is closed, false otherwise.

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

Returns true if the tile is open, false otherwise.

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

Returns true if the tile contains a mine, false otherwise.

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

Returns true if clicking this tile does not end the game, false otherwise.

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

Returns true if this tile has to be clicked in order for the game to successfully end, false otherwise.

This is false for open mines — returns true only for ClosedEmpty.

pub fn flag_state(&self) -> Option<&Flag<Cf>>[src]

Returns the type of flag installed on this tile, or None if this tile is open and thus cannot hold a flag.

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

Returns true if the flag_state is Some(Flag::Flagged), false otherwise.

pub fn custom_flag(&self) -> Option<&Cf>[src]

Returns the custom flag value if the tile can hold a flag and the installed flag is a custom one, None otherwise.

pub fn peek_local(&self) -> Option<ClickOutcome>[src]

Returns a ClickOutcome from the data known only to this specific tile, or None if returning one requires access to the field.

Trait Implementations

impl<Cf: Clone> Clone for TileState<Cf>[src]

impl<Cf: Copy> Copy for TileState<Cf>[src]

impl<Cf: Debug> Debug for TileState<Cf>[src]

impl<Cf> Default for TileState<Cf>[src]

fn default() -> Self[src]

Returns the ClosedEmpty variant.

impl<'de, Cf> Deserialize<'de> for TileState<Cf> where
    Cf: Deserialize<'de>, 
[src]

impl<Cf> Eq for TileState<Cf>[src]

impl<Ct, Cf> From<TileState<Cf>> for Tile<Ct, Cf> where
    Ct: Default
[src]

impl<Cf> PartialEq<TileState<Cf>> for TileState<Cf>[src]

fn eq(&self, other: &Self) -> bool[src]

Compares two tiles.

Two tiles are equal if they're both empty or they both contain a mine. Other factors, like the presence of a flag or amount of surrounding mines are not compared.

impl<Cf> Serialize for TileState<Cf> where
    Cf: Serialize
[src]

Auto Trait Implementations

impl<Cf> RefUnwindSafe for TileState<Cf> where
    Cf: RefUnwindSafe

impl<Cf> Send for TileState<Cf> where
    Cf: Send

impl<Cf> Sync for TileState<Cf> where
    Cf: Sync

impl<Cf> Unpin for TileState<Cf> where
    Cf: Unpin

impl<Cf> UnwindSafe for TileState<Cf> where
    Cf: 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> DeserializeOwned for T where
    T: for<'de> Deserialize<'de>, 
[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.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,