use num_traits::{One, PrimInt};
fn pluralize<T: PrimInt + One>(n: T, base: &str, plural_suffix: &str) -> String {
if n.is_one() {
base.to_string()
} else {
base.to_string() + plural_suffix
}
}
#[non_exhaustive]
#[derive(Debug, Eq, PartialEq, thiserror::Error)]
pub enum EvaluatorError {
#[non_exhaustive]
#[error("{card_set_type} does not have at least {expected_count} {} (Got instead {actual_count} {})", pluralize(*.expected_count, "card", "s"), pluralize(*.actual_count, "card", "s"))]
NotEnoughCards {
card_set_type: String,
expected_count: u64,
actual_count: u64,
},
#[non_exhaustive]
#[error("{card_set_type} does not have at most {expected_count} {} (Got instead {actual_count} {})", pluralize(*.expected_count, "card", "s"), pluralize(*.actual_count, "card", "s"))]
TooManyCards {
card_set_type: String,
expected_count: u64,
actual_count: u64,
},
#[non_exhaustive]
#[error("Failed to calculate rank based off of set of cards: {0}")]
FailedToCalculateRank(String),
}