From 9e5bb81f13eb98c14ba12d6c68901a228778b665 Mon Sep 17 00:00:00 2001 From: Aryadev Chavali Date: Thu, 16 Apr 2026 21:10:32 +0100 Subject: [PATCH] game:deck: some docs --- src/game/deck.rs | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/game/deck.rs b/src/game/deck.rs index 897ea53..0dd1f69 100644 --- a/src/game/deck.rs +++ b/src/game/deck.rs @@ -19,6 +19,8 @@ impl Deck { Self(Vec::new()) } + /// Create a new deck composed of `n` of decks of cards (using + /// `Card::iter_all`). Guaranteed to have 54`n` cards by construction. pub fn new_full(n: usize) -> Self { assert!(n > 0); Self(Card::iter_all(n as i64).collect()) @@ -36,10 +38,13 @@ impl Deck { self.0.shuffle(rng); } + /// Sort cards within the deck by the ordering implementation for Cards. + /// See [[file:../card/ord.rs::impl Ord for Card {]]. pub fn sort(&mut self) { self.0.sort(); } + /// Sort cards within the deck by suit in ascending order. pub fn sort_by_suit(&mut self) { // Sort by suit then rank self.0.sort_by(|x, y| {