pub struct BasicRules { /* private fields */ }Expand description
The rules for basic Rummy.
Implementations§
Source§impl BasicRules
impl BasicRules
Sourcepub fn new(config: BasicConfig) -> Self
pub fn new(config: BasicConfig) -> Self
Initialize the rules.
Trait Implementations§
Source§impl Clone for BasicRules
impl Clone for BasicRules
Source§fn clone(&self) -> BasicRules
fn clone(&self) -> BasicRules
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 BasicRules
impl Debug for BasicRules
Source§impl GameRules for BasicRules
impl GameRules for BasicRules
Source§type VariantState = BasicState
type VariantState = BasicState
The state that this variant requires.
Source§type VariantScore = BasicScore
type VariantScore = BasicScore
The score type of this variant (for each player).
Source§fn handle_draw_deck(
&self,
state: &mut GameState<BasicScore, BasicRules>,
action: DrawDeckAction,
) -> Result<(), ActionError>
fn handle_draw_deck( &self, state: &mut GameState<BasicScore, BasicRules>, action: DrawDeckAction, ) -> Result<(), ActionError>
Handle drawing from the deck.
Source§fn handle_draw_discard_pile(
&self,
state: &mut GameState<BasicScore, BasicRules>,
action: DrawDiscardPileAction,
) -> Result<(), ActionError>
fn handle_draw_discard_pile( &self, state: &mut GameState<BasicScore, BasicRules>, action: DrawDiscardPileAction, ) -> Result<(), ActionError>
Handle drawing from the discard pile.
Source§fn handle_lay_off(
&self,
state: &mut GameState<BasicScore, BasicRules>,
action: LayOffAction,
) -> Result<(), ActionError>
fn handle_lay_off( &self, state: &mut GameState<BasicScore, BasicRules>, action: LayOffAction, ) -> Result<(), ActionError>
Handle laying off a card from the player’s hand.
Source§fn handle_form_meld(
&self,
state: &mut GameState<BasicScore, BasicRules>,
action: FormMeldAction,
) -> Result<(), ActionError>
fn handle_form_meld( &self, state: &mut GameState<BasicScore, BasicRules>, action: FormMeldAction, ) -> Result<(), ActionError>
Handle forming a single meld.
Source§fn handle_form_melds(
&self,
state: &mut GameState<BasicScore, BasicRules>,
action: FormMeldsAction,
) -> Result<(), ActionError>
fn handle_form_melds( &self, state: &mut GameState<BasicScore, BasicRules>, action: FormMeldsAction, ) -> Result<(), ActionError>
Handle forming multiple melds at one time. Either all melds successfully form, or none do.
Source§fn handle_discard(
&self,
state: &mut GameState<BasicScore, BasicRules>,
action: DiscardAction,
) -> Result<(), ActionError>
fn handle_discard( &self, state: &mut GameState<BasicScore, BasicRules>, action: DiscardAction, ) -> Result<(), ActionError>
Handle discarding a card.
Source§fn calculate_round_score(
&self,
state: &GameState<BasicScore, BasicRules>,
) -> Result<RoundScore<Self::VariantScore>, GameError>
fn calculate_round_score( &self, state: &GameState<BasicScore, BasicRules>, ) -> Result<RoundScore<Self::VariantScore>, GameError>
Calculate the score for a round. Returns an
Err if the round hasn’t ended.Source§fn execute_action(
&self,
state: &mut GameState<Self::VariantScore, Self>,
action: GameAction,
) -> Result<(), ActionError>
fn execute_action( &self, state: &mut GameState<Self::VariantScore, Self>, action: GameAction, ) -> Result<(), ActionError>
Executes an action, returning an
() or ActionError.Source§impl PartialEq for BasicRules
impl PartialEq for BasicRules
Source§impl VariantState<BasicScore, BasicRules> for BasicState
impl VariantState<BasicScore, BasicRules> for BasicState
Source§fn validate_action(
state: &GameState<P, R>,
action: &GameAction,
) -> Result<(), ActionError>
fn validate_action( state: &GameState<P, R>, action: &GameAction, ) -> Result<(), ActionError>
Validate if an action is generally valid in the current gamestate, for the variant. Read more
impl Eq for BasicRules
impl StructuralPartialEq for BasicRules
Auto Trait Implementations§
impl Freeze for BasicRules
impl RefUnwindSafe for BasicRules
impl Send for BasicRules
impl Sync for BasicRules
impl Unpin for BasicRules
impl UnwindSafe for BasicRules
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