classifier: display method for Hand

This commit is contained in:
2026-04-01 01:01:46 +01:00
committed by oreodave
parent 839bb9375c
commit 8c8e030071

View File

@@ -185,3 +185,34 @@ fn consecutive_ranks(num_jokers: i32, cards: &[Card]) -> bool {
} }
return true; return true;
} }
mod impls {
use super::*;
use std::fmt::{Display, Formatter, Result};
impl Display for Hand {
fn fmt(&self, f: &mut Formatter<'_>) -> Result {
match self {
Hand::Single(c1) => write!(f, "Single[{}]", c1),
Hand::Pair(c1, c2) => write!(f, "Pair[{}, {}]", c1, c2),
Hand::Triple(c1, c2, c3) => {
write!(f, "Triple[{}, {}, {}]", c1, c2, c3)
}
Hand::Poker {
poker_type,
c1,
c2,
c3,
c4,
c5,
} => {
write!(
f,
"Poker[{:?}: {}, {}, {}, {}, {}]",
poker_type, c1, c2, c3, c4, c5
)
}
}
}
}
}