pub struct Discarding { /* private fields */ }Expand description
Represents the game state during the discarding phase, where players select cards to contribute to the crib.
This phase occurs after roles have been assigned and hands dealt, but before the play phase begins. Each player removes cards from their hand, and those cards are accumulated into the crib for the upcoming scoring sequence.
Implementations§
Source§impl Discarding
impl Discarding
Sourcepub fn new(
scoreboard: Scoreboard,
roles: Roles,
hands: Hands,
crib: Crib,
deck: Deck,
pending: Pending,
) -> Self
pub fn new( scoreboard: Scoreboard, roles: Roles, hands: Hands, crib: Crib, deck: Deck, pending: Pending, ) -> Self
Constructs a new Discarding state.
The caller must ensure that the provided inputs are coherent and reflect a valid pre-discarding state.
Sourcepub fn discard_cards_to_crib(&mut self, player: Player, discards: &[Card])
pub fn discard_cards_to_crib(&mut self, player: Player, discards: &[Card])
Moves the specified cards from player’s hand into the crib.
This method performs the following operations atomically:
- Removes all
discardsfrom the player’s hand. - Adds all
discardsto the crib. - Marks the player as having completed their discard action via the pending-state mechanism.
Trait Implementations§
Source§impl Clone for Discarding
impl Clone for Discarding
Source§fn clone(&self) -> Discarding
fn clone(&self) -> Discarding
Returns a duplicate of the value. Read more
1.0.0 · Source§fn clone_from(&mut self, source: &Self)
fn clone_from(&mut self, source: &Self)
Performs copy-assignment from
source. Read moreSource§impl Debug for Discarding
impl Debug for Discarding
Source§impl<'de> Deserialize<'de> for Discarding
impl<'de> Deserialize<'de> for Discarding
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
Source§impl Display for Discarding
impl Display for Discarding
Source§impl HasCrib for Discarding
impl HasCrib for Discarding
Source§impl HasDeck for Discarding
impl HasDeck for Discarding
Source§impl HasHands for Discarding
impl HasHands for Discarding
Source§impl HasPending for Discarding
impl HasPending for Discarding
Source§impl HasRoles for Discarding
impl HasRoles for Discarding
Source§impl HasScoreboard for Discarding
impl HasScoreboard for Discarding
Source§fn scoreboard(&self) -> &Scoreboard
fn scoreboard(&self) -> &Scoreboard
Returns an immutable reference to the scoreboard.
Source§fn scoreboard_mut(&mut self) -> &mut Scoreboard
fn scoreboard_mut(&mut self) -> &mut Scoreboard
Returns a mutable reference to the scoreboard.
Source§impl PartialEq for Discarding
impl PartialEq for Discarding
Source§impl Serialize for Discarding
impl Serialize for Discarding
impl Eq for Discarding
impl StructuralPartialEq for Discarding
Auto Trait Implementations§
impl Freeze for Discarding
impl RefUnwindSafe for Discarding
impl Send for Discarding
impl Sync for Discarding
impl Unpin for Discarding
impl UnwindSafe for Discarding
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,
§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
Compare self to
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>
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