Skip to main content

server/domain/cards/
crib.rs

1use super::pile::Pile;
2
3/// Marker type for the crib pile.
4#[derive(Clone, Debug, PartialEq, Eq)]
5pub struct CribType;
6
7/// The crib is the special pile of cards discarded cards that belongs to the dealer
8/// and is scored at the end of the pegging phase.
9///
10/// Contains 4 cards (2 from each player) in this standard six-card Cribbage.
11pub type Crib = Pile<CribType>;
12
13/// Trait for game states that contain a crib.
14pub trait HasCrib {
15    /// Immutable access to the crib.
16    fn crib(&self) -> &Crib;
17
18    /// Mutable access to the crib.
19    fn crib_mut(&mut self) -> &mut Crib;
20}