open_pql/base/
rank16_iter.rs1use super::{Card64, Rank16, Suit};
2
3#[derive(Debug, Clone)]
8pub struct Rank16Iter {
9 c64: Card64,
10 suit_idx: u8,
11}
12
13impl Rank16Iter {
14 pub(crate) const fn new(c64: Card64) -> Self {
16 Self { c64, suit_idx: 0 }
17 }
18}
19
20impl Iterator for Rank16Iter {
21 type Item = (Rank16, Suit);
22
23 fn next(&mut self) -> Option<Self::Item> {
24 let suit = match self.suit_idx {
25 0 => Suit::S,
26 1 => Suit::H,
27 2 => Suit::D,
28 3 => Suit::C,
29 _ => return None,
30 };
31
32 self.suit_idx += 1;
33
34 Some((self.c64.ranks_by_suit(suit), suit))
35 }
36}