[][src]Enum sweeper::Tile

pub enum Tile {
    ClosedEmpty(Flag),
    OpenEmpty,
    OpenNumber(NonZeroU8),
    Mine(Flag),
}

A Minesweeper tile.

Variants

ClosedEmpty(Flag)

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)

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

Methods

impl Tile[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>[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 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 Clone for Tile[src]

impl Copy for Tile[src]

impl Debug for Tile[src]

impl Default for Tile[src]

fn default() -> Self[src]

Returns the ClosedEmpty variant.

impl<'de> Deserialize<'de> for Tile[src]

impl Eq for Tile[src]

impl PartialEq<Tile> for Tile[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 Serialize for Tile[src]

Auto Trait Implementations

impl RefUnwindSafe for Tile

impl Send for Tile

impl Sync for Tile

impl Unpin for Tile

impl UnwindSafe for Tile

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>,