Trait onejoker::poker::hand_value::HandLevelTrait

source ·
pub trait HandLevelTrait: Copy {
    // Required methods
    fn index(&self) -> u32;
    fn from_index(i: u32) -> Self;
    fn best() -> Self;
    fn worst() -> Self;
}
Expand description

wiki | Base class for categories of poker hands.

Poker hands are ranked by first grouping them into categories (which here we call “level”), and then comparing the ranks of the cards within that level to break ties. We use the actual numbers here for calculating comparators, and comparators are valued such that lower numbers mean better hands.

Required Methods§

source

fn index(&self) -> u32

Integer value of the level, used in comparator calculations.

source

fn from_index(i: u32) -> Self

Convert an integer index to a level.

source

fn best() -> Self

Level representing the best hand: this is the lowest number.

source

fn worst() -> Self

Level representing the worst hand: this is the highest number.

Object Safety§

This trait is not object safe.

Implementors§