projects
/
poker-eval.git
/ commitdiff
commit
grep
author
committer
pickaxe
?
search:
re
summary
|
shortlog
|
log
|
commit
| commitdiff |
tree
raw
|
patch
| inline |
side by side
(parent:
911419e
)
feat: add From<Cards> for Vec<u32> and transparent repr for Card
author
MA Beaudet
<ma@beaudet.xyz>
Sun, 7 Nov 2021 19:45:12 +0000
(20:45 +0100)
committer
MA Beaudet
<ma@beaudet.xyz>
Sun, 7 Nov 2021 19:45:12 +0000
(20:45 +0100)
src/lib.rs
patch
|
blob
|
blame
|
history
diff --git
a/src/lib.rs
b/src/lib.rs
index
e173037
..
c5e5543
100644
(file)
--- a/
src/lib.rs
+++ b/
src/lib.rs
@@
-260,6
+260,12
@@
impl std::fmt::Display for Cards {
}
}
+impl From<Cards> for Vec<u32> {
+ fn from(c: Cards) -> Self {
+ c.0.into_iter().map(|c| u32::from(c)).collect()
+ }
+}
+
/// ```
/// use poker_eval::{Card};
/// use std::str::FromStr;
@@
-268,6
+274,7
@@
impl std::fmt::Display for Cards {
/// Card::from_str("Kd").unwrap().get(),
/// 0b00001000_00000000_01001011_00100101_u32
/// );
+#[repr(transparent)]
#[derive(Debug, Clone, Copy)]
pub struct Card(u32);