Enum poker::EvalClass[][src]

pub enum EvalClass {
    HighCard {
        high_rank: Rank,
    },
    Pair {
        pair: Rank,
    },
    TwoPair {
        first_pair: Rank,
        second_pair: Rank,
    },
    ThreeOfAKind {
        trips: Rank,
    },
    Straight {
        high_rank: Rank,
    },
    Flush {
        high_rank: Rank,
    },
    FullHouse {
        trips: Rank,
        pair: Rank,
    },
    FourOfAKind {
        quads: Rank,
    },
    StraightFlush {
        high_rank: Rank,
    },
}

A utility enumeration type for pattern matching against the result of Eval::class. Each variant represents a class of poker hand. Royal flush is not included, but can be matched against EvalClass:StraightFlush { high_card: Rank::Ace } if desired.

Example

use poker::{cards, Evaluator, EvalClass, Rank};

let hand = cards!(
    Ace of Clubs,
    Two of Spades,
    Three of Diamonds,
    Four of Diamonds,
    Five of Clubs,
);
let eval = Evaluator::new();
let result = eval.evaluate(&hand).expect("couldn't evaluate hand");
assert!(matches!(result.class(), EvalClass::Straight { high_rank: Rank::Five }));

Variants

HighCard

A high card, or no hand.

Fields of HighCard

high_rank: Rank

The high card rank.

Pair

A pair, two cards of the same rank

Fields of Pair

pair: Rank

The ranks of the pair.

TwoPair

Two pair. two cards of the same rank and two other cards of the same but distinct rank

Fields of TwoPair

first_pair: Rank

The ranks of the first pair.

second_pair: Rank

The ranks of the second pair.

ThreeOfAKind

Three of a kind, three cards of the same rank. Sometimes called trips.

Fields of ThreeOfAKind

trips: Rank

The ranks of the trips.

Straight

A straight, five cards in rank order. Straights go from A2345 to TJQKA.

Fields of Straight

high_rank: Rank

The rank of the highest card in the straight.

Flush

A flush, five cards of the same suit.

Fields of Flush

high_rank: Rank

The rank of the highest card in the flush.

FullHouse

A full house, one pair and one three of a kind

Fields of FullHouse

trips: Rank

The rank of the trips of the full house.

pair: Rank

The rank of the pair of the full house.

FourOfAKind

Four of a kind, four cards of the same rank. Sometimes called quads.

Fields of FourOfAKind

quads: Rank

The rank of the quads.

StraightFlush

A straight flush, like a straight but all the cards are of the same suit.

Fields of StraightFlush

high_rank: Rank

The rank of the highest card in the straight flush.

Trait Implementations

impl Clone for EvalClass[src]

impl Copy for EvalClass[src]

impl Debug for EvalClass[src]

impl Eq for EvalClass[src]

impl Ord for EvalClass[src]

impl PartialEq<EvalClass> for EvalClass[src]

impl PartialOrd<EvalClass> for EvalClass[src]

impl StructuralEq for EvalClass[src]

impl StructuralPartialEq for EvalClass[src]

Auto Trait Implementations

Blanket Implementations

impl<T> Any for T where
    T: 'static + ?Sized
[src]

impl<T> Borrow<T> for T where
    T: ?Sized
[src]

impl<T> BorrowMut<T> for T where
    T: ?Sized
[src]

impl<T> From<T> for T[src]

impl<T, U> Into<U> for T where
    U: From<T>, 
[src]

impl<T> ToOwned for T where
    T: Clone
[src]

type Owned = T

The resulting type after obtaining ownership.

impl<T, U> TryFrom<U> for T where
    U: Into<T>, 
[src]

type Error = Infallible

The type returned in the event of a conversion error.

impl<T, U> TryInto<U> for T where
    U: TryFrom<T>, 
[src]

type Error = <U as TryFrom<T>>::Error

The type returned in the event of a conversion error.

impl<V, T> VZip<V> for T where
    V: MultiLane<T>,