open_pql/pql_type/
mod.rs

1use super::{
2    prim::math::combinatorics::{
3        combination_of_2_index_to_ranks, combination_of_3_index_to_ranks,
4    },
5    *,
6};
7
8mod hand_rating_view;
9mod hand_type_ordering;
10mod pql_board_range;
11mod pql_boolean;
12mod pql_card;
13mod pql_card_count;
14mod pql_double;
15mod pql_equity;
16mod pql_flop_hand_category;
17mod pql_fraction;
18mod pql_game;
19mod pql_hand_ranking;
20mod pql_hand_type;
21mod pql_hi_rating;
22mod pql_integer;
23mod pql_lo_rating;
24mod pql_long;
25mod pql_numeric;
26mod pql_player;
27mod pql_player_count;
28mod pql_range;
29mod pql_rank;
30mod pql_rank_set;
31mod pql_street;
32mod pql_string;
33mod pql_suit;
34mod pql_suit_set;
35mod rating_memory_layout;
36
37pub use hand_rating_view::HandRatingView;
38pub use hand_type_ordering::HandTypeOrd;
39pub use pql_board_range::PQLBoardRange;
40pub use pql_boolean::PQLBoolean;
41pub use pql_card::PQLCard;
42pub use pql_card_count::PQLCardCount;
43pub use pql_double::PQLDouble;
44pub use pql_equity::PQLEquity;
45pub use pql_flop_hand_category::*;
46pub use pql_fraction::PQLFraction;
47pub use pql_game::PQLGame;
48pub use pql_hand_type::*;
49pub use pql_hi_rating::PQLHiRating;
50pub use pql_integer::PQLInteger;
51pub use pql_lo_rating::PQLLoRating;
52pub use pql_long::PQLLong;
53pub use pql_numeric::PQLNumeric;
54pub use pql_player::PQLPlayer;
55pub use pql_player_count::PQLPlayerCount;
56pub use pql_range::PQLRange;
57pub use pql_rank::PQLRank;
58pub use pql_rank_set::PQLRankSet;
59pub use pql_street::PQLStreet;
60pub use pql_string::PQLString;
61pub use pql_suit::PQLSuit;
62pub use pql_suit_set::PQLSuitSet;
63use rating_memory_layout::RatingMemoryLayout;
64
65#[derive(Clone, Copy, Debug, PartialEq, Eq, Display)]
66pub enum PQLType {
67    BoardRange,
68    Boolean,
69    Card,
70    CardCount,
71    Double,
72    Equity,
73    FlopHandCategory,
74    Fraction,
75    HandRanking,
76    HandType,
77    HiRating,
78    Integer,
79    Long,
80    LoRating,
81    Numeric,
82    Player,
83    PlayerCount,
84    Range,
85    Rank,
86    RankSet,
87    Street,
88    String,
89}
90
91#[cfg(test)]
92mod tests {
93    use PQLType::*;
94
95    use super::*;
96
97    impl PQLType {
98        pub(crate) const fn is_num(self) -> bool {
99            matches!(
100                self,
101                Self::Double
102                    | Self::Equity
103                    | Self::Long
104                    | Self::Integer
105                    | Self::CardCount
106                    | Self::PlayerCount
107                    | Self::Fraction
108                    | Self::Numeric
109            )
110        }
111    }
112
113    impl Arbitrary for PQLType {
114        fn arbitrary(g: &mut quickcheck::Gen) -> Self {
115            #[allow(unused)]
116            const fn completeness_check(e: PQLType) {
117                match e {
118                    BoardRange | Boolean | Card | CardCount | Double
119                    | Equity | FlopHandCategory | Fraction | HandRanking
120                    | HandType | HiRating | Integer | Long | LoRating
121                    | Numeric | Player | PlayerCount | Range | Rank
122                    | RankSet | Street | String => (),
123                }
124            }
125
126            *g.choose(&[
127                BoardRange,
128                Boolean,
129                Card,
130                CardCount,
131                Double,
132                Equity,
133                FlopHandCategory,
134                Fraction,
135                HandRanking,
136                HandType,
137                HiRating,
138                Integer,
139                Long,
140                LoRating,
141                Numeric,
142                Player,
143                PlayerCount,
144                Range,
145                Rank,
146                RankSet,
147                Street,
148                String,
149            ])
150            .unwrap()
151        }
152    }
153}