openpql-runner 0.2.2

A high-performance Rust implementation of Poker Query Language (PQL), enabling SQL-like queries for poker analysis and calculations. This project is a spiritual successor to the original Java implementation developed by Odds Oracle.
Documentation
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
use super::*;

#[pqlfn]
pub fn rate_hi_hand(ctx: &PQLFnContext, text: &PQLString) -> Result<PQLHiRating, RuntimeError> {
    let game = match ctx.game {
        PQLGame::Holdem | PQLGame::Omaha | PQLGame::Omaha5 => PQLGame::Holdem,
        PQLGame::ShortDeck => PQLGame::ShortDeck,
    };

    parse_cards(text).map_or(Err(RuntimeError::InvalidHand), |cards| {
        if cards.count() == 5 {
            Ok(game.eval_rating(cards, PQLCardSet::default()))
        } else {
            Err(RuntimeError::RequiresFiveCards)
        }
    })
}