use std::cmp::Ordering;
use std::collections::{HashMap, HashSet};
+use std::convert::TryInto;
use itertools::Itertools;
use crate::rng::{Seed, WaveRng};
use crate::seats::Seats;
use crate::username::Username;
-use crate::util::{array::TryIntoArray, max::IteratorMaxItems, timestamp::Timestamp};
+use crate::util::{max::IteratorMaxItems, timestamp::Timestamp};
use super::super::{Action, ActionError, DealerAction, Game, StartCondition, UserAction, ValidatedUserAction};
.iter()
.sorted_by_key(|&(username, _)| username)
.map(|(&username, hand)| (username, hand.iter().chain(self.community.iter()).cloned().collect::<Vec<_>>()))
- .filter_map(|(username, cards)| cards.try_into_array().ok().map(rank_7_card_hand).map(|hand| (username, hand)))
+ .filter_map(|(username, cards)| cards.try_into().ok().map(rank_7_card_hand).map(|hand| (username, hand)))
.max_items_by_key(|(_, hand)| *hand);
info!("Showdown: community: {:?}", self.community);
info!("Showdown: all hands: {:?}", self.hands);
+++ /dev/null
-pub trait TryIntoArray<A> {
- fn try_into_array(self) -> Result<A, usize>;
-}
-
-impl <T: Copy> TryIntoArray<[T; 7]> for Vec<T> {
- fn try_into_array(self) -> Result<[T; 7], usize> {
- match *self {
- [a, b, c, d, e, f, g] => Ok([a, b, c, d, e, f, g]),
- _ => Err(self.len()),
- }
- }
-}