Struct libcoinche::game::GameState
source · [−]pub struct GameState { /* private fields */ }
Expand description
Describes the state of a coinche game, ready to play a card.
Implementations
sourceimpl GameState
impl GameState
sourcepub fn new(first: PlayerPos, hands: [Hand; 4], contract: Contract) -> Self
pub fn new(first: PlayerPos, hands: [Hand; 4], contract: Contract) -> Self
Creates a new GameState, with the given cards, first player and contract.
sourcepub fn play_card(
&mut self,
player: PlayerPos,
card: Card
) -> Result<TrickResult, PlayError>
pub fn play_card(
&mut self,
player: PlayerPos,
card: Card
) -> Result<TrickResult, PlayError>
Try to play a card
sourcepub fn next_player(&self) -> PlayerPos
pub fn next_player(&self) -> PlayerPos
Returns the player expected to play next.
sourcepub fn last_trick(&self) -> Result<&Trick, PlayError>
pub fn last_trick(&self) -> Result<&Trick, PlayError>
Return the last trick, if possible
sourcepub fn current_trick(&self) -> &Trick
pub fn current_trick(&self) -> &Trick
Returns the current trick.
Trait Implementations
Auto Trait Implementations
impl RefUnwindSafe for GameState
impl Send for GameState
impl Sync for GameState
impl Unpin for GameState
impl UnwindSafe for GameState
Blanket Implementations
sourceimpl<T> BorrowMut<T> for T where
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
const: unstable · sourcefn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more