Struct riichi_tools_rs::riichi::tile::Tile[][src]

pub struct Tile {
    pub tile_type: TileType,
    pub is_red: bool,
    pub is_open: bool,
    pub is_draw: bool,
    pub is_chi: bool,
    pub is_pon: bool,
    pub called_from: u8,
    pub is_kan: bool,
    pub is_riichi: bool,
    pub is_tsumogiri: bool,
    pub id_136: Option<u8>,
}

Fields

tile_type: TileTypeis_red: boolis_open: boolis_draw: boolis_chi: boolis_pon: boolcalled_from: u8is_kan: boolis_riichi: boolis_tsumogiri: boolid_136: Option<u8>

Implementations

impl Tile[src]

pub fn new(tile_type: TileType) -> Tile[src]

pub fn from_text(representation: &str) -> Result<Tile, RiichiError>[src]

pub fn from_id(id: u8) -> Result<Tile, RiichiError>[src]

id is an integer value > 0 of a tile. The order is Manzu - Pinzu - Souzu - Winds - Dragons

pub fn to_id(&self) -> u8[src]

Gets the id of this tile based on its type

pub fn to_id_minus_1(&self) -> u8[src]

Some algorithms use ids starting from 0

pub fn next_id(&self, dora: bool, depth: u8) -> u8[src]

Returns an ID of the next tile in order.

pub fn prev_id(&self, dora: bool, depth: u8) -> u8[src]

Returns an ID of the previous tile in order.

pub fn next(&self, dora: bool) -> Option<Tile>[src]

1-8 returns the next number 9 returns None for dora = false, 1 for dora = true honors return None for dora = false, honor order for dora = true

pub fn prev(&self) -> Option<Tile>[src]

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

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

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

pub fn get_type_char(&self) -> char[src]

pub fn get_value(&self) -> u8[src]

Trait Implementations

impl Clone for Tile[src]

impl Copy for Tile[src]

impl Debug for Tile[src]

impl Default for Tile[src]

impl Display for Tile[src]

impl Eq for Tile[src]

impl Ord for Tile[src]

impl PartialEq<Tile> for Tile[src]

impl PartialOrd<Tile> for Tile[src]

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> 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> ToString for T where
    T: Display + ?Sized
[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.

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