pub struct Playing { /* private fields */ }Expand description
Represents the state of a game during the playing phase.
This structure aggregates all state required to execute card play, including score tracking, player roles, player hands, the current play-sequence state machine, and items specific to the round such as the crib, starter card, and any pending actions.
Implementations§
Source§impl Playing
impl Playing
Sourcepub const fn new(
scoreboard: Scoreboard,
roles: Roles,
hands: Hands,
play_state: PlayState,
crib: Crib,
starter_cut: StarterCut,
pending: Pending,
) -> Self
pub const fn new( scoreboard: Scoreboard, roles: Roles, hands: Hands, play_state: PlayState, crib: Crib, starter_cut: StarterCut, pending: Pending, ) -> Self
Constructs a new Playing instance from all required subcomponents.
All inputs must represent a consistent state at the beginning of the playing phase. The function does not perform validation; callers are responsible for ensuring that the inputs are coherent and legal for the game being implemented.
Sourcepub fn play_card(&mut self, card: Card)
pub fn play_card(&mut self, card: Card)
Plays a card from the next player in turn order.
This method:
- Determines which player is next to act via
play_state.next_to_play(). - Removes the specified
cardfrom that player’s hand. - Forwards the card to the
play_statestate machine to update peg totals, legality, and transition conditions.
Callers should ensure that the card is legal to play under the rules
enforced by PlayState.
Sourcepub fn go(&mut self)
pub fn go(&mut self)
Signals “go” for the next player in turn order.
A “go” occurs when a player cannot legally play any card without
exceeding the allowable running total. This method delegates to the
play_state state machine to record the event and update turn order.
Caller should ensure the player has no valid cards to play.
Trait Implementations§
Source§impl<'de> Deserialize<'de> for Playing
impl<'de> Deserialize<'de> for Playing
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>,
Source§impl HasHands for Playing
impl HasHands for Playing
Source§impl HasPegging for Playing
impl HasPegging for Playing
Source§impl HasPending for Playing
impl HasPending for Playing
Source§impl HasPlayState for Playing
impl HasPlayState for Playing
Source§fn play_state(&self) -> &PlayState
fn play_state(&self) -> &PlayState
Source§fn play_state_mut(&mut self) -> &mut PlayState
fn play_state_mut(&mut self) -> &mut PlayState
Source§impl HasScoreboard for Playing
impl HasScoreboard for Playing
Source§fn scoreboard(&self) -> &Scoreboard
fn scoreboard(&self) -> &Scoreboard
Source§fn scoreboard_mut(&mut self) -> &mut Scoreboard
fn scoreboard_mut(&mut self) -> &mut Scoreboard
Source§impl HasStarterCut for Playing
impl HasStarterCut for Playing
Source§fn starter_cut(&self) -> &StarterCut
fn starter_cut(&self) -> &StarterCut
impl Eq for Playing
impl StructuralPartialEq for Playing
Auto Trait Implementations§
impl Freeze for Playing
impl RefUnwindSafe for Playing
impl Send for Playing
impl Sync for Playing
impl Unpin for Playing
impl UnwindSafe for Playing
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
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
§impl<Q, K> Equivalent<K> for Q
impl<Q, K> Equivalent<K> for Q
§fn equivalent(&self, key: &K) -> bool
fn equivalent(&self, key: &K) -> bool
key and return true if they are equal.§impl<T> Instrument for T
impl<T> Instrument for T
§fn instrument(self, span: Span) -> Instrumented<Self>
fn instrument(self, span: Span) -> Instrumented<Self>
§fn in_current_span(self) -> Instrumented<Self>
fn in_current_span(self) -> Instrumented<Self>
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>
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>
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