+#[derive(Default)]
+pub struct Discard {
+ cards: Vec<Card>,
+}
+impl Discard {
+ pub fn discard(&mut self, card: Card) {
+ self.cards.push(card);
+ }
+}
+
+pub struct Library {
+ cards: Vec<Card>,
+}
+impl Library {
+ #[must_use]
+ pub fn new(cards: Vec<Card>) -> Self {
+ Self { cards }
+ }
+ pub fn draw(&mut self, discard: &mut Discard) -> Option<Card> {
+ if self.cards.is_empty() {
+ if let Some(top_discard) = discard.cards.pop() {
+ std::mem::swap(&mut self.cards, &mut discard.cards);
+ discard.discard(top_discard);
+ // TODO: Shuffle
+ }
+ }
+ self.cards.pop()
+ }
+}
+