pub struct Tile {
pub value: u32,
}
Expand description
Represents a single tile on the game board
Fields§
§value: u32
Tile value (0 for empty, 2^n for filled tiles)
Implementations§
Source§impl Tile
impl Tile
Sourcepub fn can_merge_with(&self, other: &Tile) -> bool
pub fn can_merge_with(&self, other: &Tile) -> bool
Check if the tile can merge with another tile
Sourcepub fn merge_with(&mut self, other: &Tile) -> u32
pub fn merge_with(&mut self, other: &Tile) -> u32
Merge this tile with another tile
Sourcepub fn color_index(&self) -> usize
pub fn color_index(&self) -> usize
Get the color index for UI rendering
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Tile
impl<'de> Deserialize<'de> for Tile
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 Tile
impl Eq for Tile
impl StructuralPartialEq for Tile
Auto Trait Implementations§
impl Freeze for Tile
impl RefUnwindSafe for Tile
impl Send for Tile
impl Sync for Tile
impl Unpin for Tile
impl UnwindSafe for Tile
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