poker/evaluate/mod.rs
1//! Anything and everything about evaluating poker hands.
2//!
3//! Given the specific format in which [`Card`] instances are coded, the key is
4//! figuring out how to leverage that data representation to quickly evaluate
5//! poker hands. (See [the `card` module] for more information).
6//!
7//! The key is the [`Evaluator`](crate::Evaluator) structure, which dynamically
8//! generates some internal [`HashMap`](std::collections::HashMap)s that it can
9//! use to quickly look up poker hands by a hand's unique key, which is a
10//! product of prime numbers that each [`Card`] instance codes.
11//!
12//! Because the [`Evaluator`](crate::Evaluator) must dynamically generate its
13//! lookup tables at *runtime*, and the tables are decently sized, it is
14//! recommended that:
15//! - You instantiate an [`Evaluator`](crate::Evaluator) as soon as possible
16//! - You avoid cloning the [`Evaluator`](crate::Evaluator)
17//!
18//! If there's going to be a performance bottleneck associated with this crate,
19//! it will be making an [`Evaluator`](crate::Evaluator) from scratch. Even so,
20//! in optimized benching, [`Evaluator::new`](crate::Evaluator::new) only takes
21//! about 300 - 400 *microseconds* (there are 1 million microseconds in 1
22//! second). Still, it is preferable to be conservative here. All
23//! [`Evaluator`](crate::Evaluator) methods borrow `Self` immutably, so pass it
24//! around as you see fit.
25//!
26//! [`Card`]: crate::Card
27//! [the `card` module]: mod@crate::card
28
29/// Core evaluation types and functionality.
30pub mod eval;
31mod evaluation;
32pub mod evaluator;
33mod five_card;
34/// Marker traits for different poker variants (three-card, five-card).
35pub mod poker_type;
36#[cfg(feature = "static_lookup")]
37pub mod static_lookup;
38mod three_card;
39mod utils;
40
41pub use five_card::hand_class::FiveCardHandClass;
42pub use three_card::hand_class::ThreeCardHandClass;