soliterm-model 0.1.0

Shared model types for soliterm
Documentation
use crate::card::Card;

pub mod cards;
pub mod split;

pub use self::cards::Cards;
pub use self::split::{Segment, SegmentMut, Split};

pub trait Pile {
    fn cards(&self) -> &[Card];
    fn len(&self) -> usize;
    fn is_empty(&self) -> bool;
}

pub trait PileMut: Pile {
    fn take_at_most(&mut self, count: usize) -> Cards;
    fn take_at_most_one(&mut self) -> Option<Card>;
    fn take_or_none(&mut self, count: usize) -> Option<Cards>;

    fn take_exactly(&mut self, count: usize) -> Cards;
    fn take_exactly_one(&mut self) -> Card;

    fn take_all(&mut self) -> Cards;

    fn place<I>(&mut self, cards: I)
    where
        I: IntoIterator<Item = Card>;
    fn place_one(&mut self, card: Card);
}