Enum poker::EvalError [−][src]
An error that can be thrown when evaluating poker hands.
Examples
If a group of Card
s to be evaluated does not contain a set of unique
cards, EvalError::CardsNotUnique
will be thrown, as shown below:
use poker::{cards, Evaluator, EvalError}; let eval = Evaluator::new(); // Two king of clubs instead of a royal flush! let hand = cards!( Ten, Clubs; Jack, Clubs; Queen, Clubs; King, Clubs; King, Clubs ).to_vec(); let result = eval.evaluate(&hand); assert_eq!( result, Err(EvalError::CardsNotUnique(hand.clone())) );
A group of 5 or more cards can be evaulated for the combination that yields
the best possible poker hand, but four of less cards cannot be evaluated.
This will throw EvalError::InvalidHandSize
:
use poker::{cards, Evaluator, EvalError}; let eval = Evaluator::new(); let four_cards = cards!( Two, Clubs; Ten, Hearts; Seven, Hearts; Eight, Spades; ).to_vec(); let result = eval.evaluate(&four_cards); assert_eq!( result, Err(EvalError::InvalidHandSize(4)), );
Variants
This variant is used when the cards to be evaluated are not all unique.
This captures the entire original hand, and the duplicates are
calculated when reporting in Display
format.
InvalidHandSize(usize)
This variant is used when the cards to be evaluated total to 4 or less.
Trait Implementations
impl Clone for EvalError
[src]
impl Debug for EvalError
[src]
impl Display for EvalError
[src]
impl Eq for EvalError
[src]
impl Error for EvalError
[src]
pub fn source(&self) -> Option<&(dyn Error + 'static)>
1.30.0[src]
pub fn backtrace(&self) -> Option<&Backtrace>
[src]
pub fn description(&self) -> &str
1.0.0[src]
pub fn cause(&self) -> Option<&dyn Error>
1.0.0[src]
impl PartialEq<EvalError> for EvalError
[src]
impl StructuralEq for EvalError
[src]
impl StructuralPartialEq for EvalError
[src]
Auto Trait Implementations
impl RefUnwindSafe for EvalError
impl Send for EvalError
impl Sync for EvalError
impl Unpin for EvalError
impl UnwindSafe for EvalError
Blanket Implementations
impl<T> Any for T where
T: 'static + ?Sized,
[src]
T: 'static + ?Sized,
impl<T> Borrow<T> for T where
T: ?Sized,
[src]
T: ?Sized,
impl<T> BorrowMut<T> for T where
T: ?Sized,
[src]
T: ?Sized,
pub fn borrow_mut(&mut self) -> &mut T
[src]
impl<T> From<T> for T
[src]
impl<T, U> Into<U> for T where
U: From<T>,
[src]
U: From<T>,
impl<T> ToOwned for T where
T: Clone,
[src]
T: Clone,
type Owned = T
The resulting type after obtaining ownership.
pub fn to_owned(&self) -> T
[src]
pub fn clone_into(&self, target: &mut T)
[src]
impl<T> ToString for T where
T: Display + ?Sized,
[src]
T: Display + ?Sized,
impl<T, U> TryFrom<U> for T where
U: Into<T>,
[src]
U: Into<T>,
type Error = Infallible
The type returned in the event of a conversion error.
pub fn try_from(value: U) -> Result<T, <T as TryFrom<U>>::Error>
[src]
impl<T, U> TryInto<U> for T where
U: TryFrom<T>,
[src]
U: TryFrom<T>,
type Error = <U as TryFrom<T>>::Error
The type returned in the event of a conversion error.
pub fn try_into(self) -> Result<U, <U as TryFrom<T>>::Error>
[src]
impl<V, T> VZip<V> for T where
V: MultiLane<T>,
V: MultiLane<T>,