#[non_exhaustive]pub struct Pon {
pub own: [Tile; 2],
pub called: Tile,
pub dir: Player,
}Expand description
An open group of 3 identical (ignoring red) tiles (ポン / 明刻). May be called from any other player’s discard.
Fields (Non-exhaustive)§
This struct is marked as non-exhaustive
Non-exhaustive structs could have additional fields added in future. Therefore, non-exhaustive structs cannot be constructed in external crates using the traditional
Struct { .. } syntax; cannot be matched against without a wildcard ..; and struct update syntax will not work.own: [Tile; 2]The calling player’s own 2 tiles.
called: TileThe called tile.
dir: Player(discarding player - self) mod 4
Implementations§
Source§impl Pon
impl Pon
pub const fn num(self) -> u8
pub const fn suit(self) -> u8
Sourcepub fn from_tiles_dir(
own0: Tile,
own1: Tile,
called: Tile,
dir: Player,
) -> Option<Self>
pub fn from_tiles_dir( own0: Tile, own1: Tile, called: Tile, dir: Player, ) -> Option<Self>
Constructs from own tiles, called tile, and the relative pos of the discarding player.
Sourcepub fn is_in_hand(self, hand: &TileSet37) -> bool
pub fn is_in_hand(self, hand: &TileSet37) -> bool
Checks whether own tiles exist in player’s closed hand.
Sourcepub fn consume_from_hand(self, hand: &mut TileSet37)
pub fn consume_from_hand(self, hand: &mut TileSet37)
Removes own tiles from player’s closed hand (assuming they exist).
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Pon
impl<'de> Deserialize<'de> for Pon
Source§fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
fn deserialize<__D>(__deserializer: __D) -> Result<Self, __D::Error>where
__D: Deserializer<'de>,
Deserialize this value from the given Serde deserializer. Read more
impl Copy for Pon
impl Eq for Pon
impl StructuralPartialEq for Pon
Auto Trait Implementations§
impl Freeze for Pon
impl RefUnwindSafe for Pon
impl Send for Pon
impl Sync for Pon
impl Unpin for Pon
impl UnwindSafe for Pon
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self>
fn into_either(self, into_left: bool) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self>
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more