open_pql/base/
card_iter.rs1use super::{Card, Card64, N_CARDS};
2
3#[derive(Debug, Clone)]
7pub struct CardIter {
8 c64: Card64,
9 idx: u8,
10}
11
12impl CardIter {
13 pub(crate) const fn new(c64: Card64) -> Self {
15 Self { c64, idx: 0 }
16 }
17}
18
19impl Iterator for CardIter {
20 type Item = Card;
21
22 fn next(&mut self) -> Option<Self::Item> {
23 while self.idx < N_CARDS {
24 let c = Card::ARR_ALL[self.idx as usize];
25 self.idx += 1;
26
27 if self.c64.contains_card(c) {
28 return Some(c);
29 }
30 }
31
32 None
33 }
34}