pub struct HandStrength(/* private fields */);Expand description
The strength of a five-card poker hand; stronger hands compare greater.
evaluate_5 and evaluate_7 return it. Equal strengths split the
pot.
use native_solver::{evaluate_5, Card, HandCategory};
let hand = |s: &str| -> [Card; 5] {
let cards: Vec<Card> = s.split(' ').map(|c| c.parse().unwrap()).collect();
cards.try_into().unwrap()
};
let flush = evaluate_5(hand("Ah 9h 7h 4h 2h"));
let straight = evaluate_5(hand("9h 8d 7s 6h 5c"));
assert!(flush > straight);
assert_eq!(flush.category(), HandCategory::Flush);Implementations§
Source§impl HandStrength
impl HandStrength
Sourcepub fn category(self) -> HandCategory
pub fn category(self) -> HandCategory
The hand’s category, e.g. HandCategory::Flush.
Trait Implementations§
Source§impl Clone for HandStrength
impl Clone for HandStrength
impl Copy for HandStrength
Source§impl Debug for HandStrength
impl Debug for HandStrength
impl Eq for HandStrength
Source§impl Hash for HandStrength
impl Hash for HandStrength
Source§impl Ord for HandStrength
impl Ord for HandStrength
1.21.0 (const: unstable) · Source§fn max(self, other: Self) -> Selfwhere
Self: Sized,
fn max(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the maximum of two values. Read more
1.21.0 (const: unstable) · Source§fn min(self, other: Self) -> Selfwhere
Self: Sized,
fn min(self, other: Self) -> Selfwhere
Self: Sized,
Compares and returns the minimum of two values. Read more
Source§impl PartialEq for HandStrength
impl PartialEq for HandStrength
Source§impl PartialOrd for HandStrength
impl PartialOrd for HandStrength
impl StructuralPartialEq for HandStrength
Auto Trait Implementations§
impl Forget for HandStrength
impl Freeze for HandStrength
impl Move for HandStrength
impl RefUnwindSafe for HandStrength
impl Send for HandStrength
impl Sync for HandStrength
impl Unpin for HandStrength
impl UnsafeUnpin for HandStrength
impl UnwindSafe for HandStrength
Blanket Implementations§
Source§impl<T> BorrowMut<T> for Twhere
T: ?Sized,
impl<T> BorrowMut<T> for Twhere
T: ?Sized,
Source§fn borrow_mut(&mut self) -> &mut T
fn borrow_mut(&mut self) -> &mut T
Mutably borrows from an owned value. Read more
Source§impl<T> CloneToUninit for Twhere
T: Clone,
impl<T> CloneToUninit for Twhere
T: Clone,
Source§impl<T> IntoEither for T
impl<T> IntoEither for T
Source§fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
fn into_either(self, into_left: bool) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left is true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read moreSource§fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
fn into_either_with<F>(self, into_left: F) -> Either<Self, Self> ⓘ
Converts
self into a Left variant of Either<Self, Self>
if into_left(&self) returns true.
Converts self into a Right variant of Either<Self, Self>
otherwise. Read more